mirror of
https://github.com/sbt/sbt.git
synced 2026-10-06 10:03:56 +02:00
[2.0.x] fix: Honor JAVA_HOME in the Unix launcher (#9825)
Problem: The Unix launcher ignores JAVA_HOME and selects Java from PATH when JAVACMD is absent. Solution: Check JAVA_HOME/bin/java before falling back to PATH while preserving explicit --java-home and JAVACMD precedence. Fixes #9794
This commit is contained in:
committed by
Eugene Yokota
parent
67b5386332
commit
f6e21bb78e
@@ -186,6 +186,7 @@ trait ShellScriptUtil extends BasicTestSuite {
|
||||
if (isWindows)
|
||||
envVars("JAVACMD") = new File(javaBinDir, "java").getAbsolutePath()
|
||||
else
|
||||
envVars("JAVACMD") = new File(javaBinDir, "java").getAbsolutePath()
|
||||
envVars("PATH") = javaBinDir + File.pathSeparator + path
|
||||
|
||||
val cmd = LauncherTestHelper.launcherCommand(testSbtScript.getAbsolutePath) ++ args
|
||||
|
||||
@@ -927,6 +927,12 @@ original_args=("$@")
|
||||
|
||||
sbt_file_opts=()
|
||||
|
||||
if [[ -f "$JAVACMD" ]]; then
|
||||
java_cmd="$JAVACMD"
|
||||
elif [[ -n "$JAVA_HOME" && -f "$JAVA_HOME/bin/java" ]]; then
|
||||
java_cmd="$JAVA_HOME/bin/java"
|
||||
fi
|
||||
|
||||
# Pull in the machine-wide settings configuration.
|
||||
if [[ -f "$machine_sbt_opts_file" ]]; then
|
||||
sbt_file_opts+=($(loadConfigFile "$machine_sbt_opts_file"))
|
||||
|
||||
Reference in New Issue
Block a user