mirror of https://github.com/sbt/sbt.git
Implement JDK 9 support for Windows
This commit is contained in:
parent
e8670ba78f
commit
1b9f618efa
|
|
@ -75,6 +75,12 @@ if defined JVM_DEBUG_PORT (
|
|||
set _JAVA_OPTS=!_JAVA_OPTS! -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=!JVM_DEBUG_PORT!
|
||||
)
|
||||
|
||||
call :process
|
||||
|
||||
call :checkjava
|
||||
|
||||
call :copyrt
|
||||
|
||||
call :run %SBT_ARGS%
|
||||
|
||||
if ERRORLEVEL 1 goto error
|
||||
|
|
@ -93,3 +99,55 @@ exit /B 1
|
|||
:end
|
||||
@endlocal
|
||||
exit /B 0
|
||||
|
||||
:process
|
||||
rem parses 1.7, 1.8, 9, etc out of java version "1.8.0_91"
|
||||
"%_JAVACMD%" -Xmx512M -version 2> "%TEMP%.\out.txt"
|
||||
set JAVA_VERSION=0
|
||||
findstr /c:"version \"9" "%TEMP%.\out.txt"
|
||||
if /I %ERRORLEVEL% EQU 0 (set JAVA_VERSION=9)
|
||||
findstr /c:"version \"1.8" "%TEMP%.\out.txt"
|
||||
if /I %ERRORLEVEL% EQU 0 (set JAVA_VERSION=1.8)
|
||||
findstr /c:"version \"1.7" "%TEMP%.\out.txt"
|
||||
if /I %ERRORLEVEL% EQU 0 (set JAVA_VERSION=1.7)
|
||||
findstr /c:"version \"1.6" "%TEMP%.\out.txt"
|
||||
if /I %ERRORLEVEL% EQU 0 (set JAVA_VERSION=1.6)
|
||||
findstr /c:"version \"1.5" "%TEMP%.\out.txt"
|
||||
if /I %ERRORLEVEL% EQU 0 (set JAVA_VERSION=1.5)
|
||||
|
||||
set rtexport=%SBT_HOME%java9-rt-export.jar
|
||||
|
||||
"%_JAVACMD%" %_JAVA_OPTS% %SBT_OPTS% -jar "%rtexport%" --global-base > "%TEMP%.\global_base.txt"
|
||||
set /p sbt_global_dir= < "%TEMP%.\global_base.txt"
|
||||
set java9_ext=%sbt_global_dir%\java9-rt-ext
|
||||
set java9_rt=%java9_ext%\rt.jar
|
||||
|
||||
echo %java9_rt%
|
||||
|
||||
exit /B 0
|
||||
|
||||
:checkjava
|
||||
set required_version=1.6
|
||||
if /I "%JAVA_VERSION%" GEQ "%required_version%" (
|
||||
exit /B 0
|
||||
)
|
||||
echo.
|
||||
echo The java installation you have is not up to date
|
||||
echo sbt requires at least version %required_version%+, you have
|
||||
echo version %JAVA_VERSION%
|
||||
echo.
|
||||
echo Please go to http://www.java.com/getjava/ and download
|
||||
echo a valid Java Runtime and install before running sbt.
|
||||
echo.
|
||||
exit /B 1
|
||||
|
||||
:copyrt
|
||||
if /I "%JAVA_VERSION%" GEQ "9" (
|
||||
if not exist "%java9_rt%" (
|
||||
echo Copying runtime jar.
|
||||
mkdir "%java9_ext%"
|
||||
"%_JAVACMD%" %_JAVA_OPTS% %SBT_OPTS% -jar "%rtexport%" "%java9_rt%"
|
||||
)
|
||||
set _JAVA_OPTS=!_JAVA_OPTS! -Dscala.ext.dirs="%java9_ext%"
|
||||
)
|
||||
exit /B 0
|
||||
|
|
|
|||
Loading…
Reference in New Issue