Add --java-home to sbt.bat

In contrast to the unix version of the sbt launcher, the windows
version lacks the functionality of specifying JAVA_HOME via launch
parameters. This commit adds the missing --java-home parameter to
sbt.bat.
This commit is contained in:
Christian Lachner 2019-06-30 14:14:57 +02:00
parent 53f847d703
commit 4a61c27538
1 changed files with 21 additions and 0 deletions

View File

@ -67,6 +67,9 @@ if "%~1" == "" goto args_end
if "%~1" == "-jvm-debug" set JVM_DEBUG=true
if "%~1" == "--jvm-debug" set JVM_DEBUG=true
if "%~1" == "-java-home" set SET_JAVA_HOME=true
if "%~1" == "--java-home" set SET_JAVA_HOME=true
if "%JVM_DEBUG%" == "true" (
set /a JVM_DEBUG_PORT=5005 2>nul >nul
) else if "!JVM_DEBUG!" == "true" (
@ -81,6 +84,24 @@ if "%JVM_DEBUG%" == "true" (
set SBT_ARGS=!SBT_ARGS! %1
)
if "%SET_JAVA_HOME%" == "true" (
set SET_JAVA_HOME=
if NOT "%~2" == "" (
if exist "%~2\bin\java.exe" (
set _JAVACMD="%~2\bin\java.exe"
set JAVA_HOME="%~2"
set JDK_HOME="%~2"
shift
) else (
echo Directory "%~2" for JAVA_HOME is not valid
goto error
)
) else (
echo Second argument for --java-home missing
goto error
)
)
shift
goto args_loop
:args_end