diff --git a/src/main/resources/com/typesafe/sbt/packager/archetypes/scripts/bat-template b/src/main/resources/com/typesafe/sbt/packager/archetypes/scripts/bat-template index 5ba105e9d..dbf58125b 100644 --- a/src/main/resources/com/typesafe/sbt/packager/archetypes/scripts/bat-template +++ b/src/main/resources/com/typesafe/sbt/packager/archetypes/scripts/bat-template @@ -57,6 +57,11 @@ if defined BUNDLED_JVM ( if "%_JAVACMD%"=="" set _JAVACMD=java +rem if configuration files exist, prepend their contents to the script arguments so it can be processed by this runner +call :parse_config "%SCRIPT_CONF_FILE%" SCRIPT_CONF_ARGS + +call :process_args %SCRIPT_CONF_ARGS% %%* + rem Detect if this java is ok to use. for /F %%j in ('"%_JAVACMD%" -version 2^>^&1') do ( if %%~j==java set JAVAINSTALLED=1 @@ -86,11 +91,6 @@ if "%JAVAOK%"=="false" ( exit /B 1 ) -rem if configuration files exist, prepend their contents to the script arguments so it can be processed by this runner -call :parse_config "%SCRIPT_CONF_FILE%" SCRIPT_CONF_ARGS - -call :process_args %SCRIPT_CONF_ARGS% %%* - set _JAVA_OPTS=!_JAVA_OPTS! !_JAVA_PARAMS! if defined CUSTOM_MAIN_CLASS ( @@ -147,6 +147,13 @@ rem Processes incoming arguments and places them in appropriate global variables goto param_loop ) + if "!_TEST_PARAM!"=="-java-home" ( + set "JAVA_HOME=%~1" + set "_JAVACMD=%~1\bin\java.exe" + shift + goto param_loop + ) + if "!_TEST_PARAM:~0,2!"=="-J" ( rem strip -J prefix call set _TEST_PARAM=!_TEST_PARAM:~2!