From 53f847d7039c086ef34c829fd843cb76ad4abf70 Mon Sep 17 00:00:00 2001 From: Christian Lachner Date: Sun, 30 Jun 2019 11:19:18 +0200 Subject: [PATCH 1/2] Fix JVM_DEBUG in sbt.bat JVM_DEBUG was broken due to a copy-pasta error in sbt.bat. This commit corrects the value assignment to the variable and therefore fixes the problem. --- src/universal/bin/sbt.bat | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/universal/bin/sbt.bat b/src/universal/bin/sbt.bat index b67083271..78cbe17a2 100644 --- a/src/universal/bin/sbt.bat +++ b/src/universal/bin/sbt.bat @@ -64,8 +64,8 @@ set INIT_SBT_VERSION=_TO_BE_REPLACED :args_loop if "%~1" == "" goto args_end -if "%~1" == "-jvm-debug" set set JVM_DEBUG=true -if "%~1" == "--jvm-debug" set set JVM_DEBUG=true +if "%~1" == "-jvm-debug" set JVM_DEBUG=true +if "%~1" == "--jvm-debug" set JVM_DEBUG=true if "%JVM_DEBUG%" == "true" ( set /a JVM_DEBUG_PORT=5005 2>nul >nul From 4a61c27538affbac3828c2eac7bd24bdc2b3a10b Mon Sep 17 00:00:00 2001 From: Christian Lachner Date: Sun, 30 Jun 2019 14:14:57 +0200 Subject: [PATCH 2/2] 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. --- src/universal/bin/sbt.bat | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/universal/bin/sbt.bat b/src/universal/bin/sbt.bat index 78cbe17a2..ac5d33212 100644 --- a/src/universal/bin/sbt.bat +++ b/src/universal/bin/sbt.bat @@ -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