Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check for Java 17 in lfc scripts and properly exit on error #1136

Merged
merged 2 commits into from
May 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions bin/lfc.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ if (-not (Test-Path $java_cmd)) {

# check for correct java version
$java_version = (Get-Command java | Select-Object -ExpandProperty Version).toString()
if ([version]$java_version -lt [version]"11.0") {
throw "JRE $java_version found but 11.0 or greater is required."
if ([version]$java_version -lt [version]"17.0") {
throw "JRE $java_version found but 17.0 or greater is required."
}

# invoke lfc
Expand Down
7 changes: 4 additions & 3 deletions lib/scripts/include.sh
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ function get_java_cmd {
java_version=$(echo "$semantic_version" | awk -F. '{printf("%03d%03d",$1,$2);}')
#echo Semantic version: "$semantic_version"
#echo Java version: "$java_version"
if [ $java_version -lt 011000 ]; then
fatal_error "JRE $semantic_version found but 1.11 or greater is required."
if [ $java_version -lt 017000 ]; then
fatal_error "JRE $semantic_version found but 1.17 or greater is required."
fi
echo ${java_cmd}
fi
Expand All @@ -104,6 +104,7 @@ function run_lfc_with_args {
fi

# Launch the compiler.
"$(get_java_cmd)" -jar "${jar_path}" "$@";
java_cmd="$(get_java_cmd)"
"${java_cmd}" -jar "${jar_path}" "$@";
exit $?
}