2022-05-03 05:00:55 +00:00
|
|
|
@echo off
|
|
|
|
|
|
|
|
set BRANCH=%1
|
|
|
|
|
|
|
|
echo Checking java version...
|
|
|
|
|
2022-05-03 05:38:04 +00:00
|
|
|
where java >nul 2>nul
|
|
|
|
if %errorlevel%==1 (
|
|
|
|
echo =======================================================================================
|
|
|
|
echo No version of Java was found!
|
|
|
|
|
2022-05-08 00:32:30 +00:00
|
|
|
echo To launch the server, you must install Java 17
|
2022-05-03 05:38:04 +00:00
|
|
|
echo =======================================================================================
|
|
|
|
|
|
|
|
exit /b
|
|
|
|
)
|
|
|
|
|
2022-05-03 05:00:55 +00:00
|
|
|
:: https://stackoverflow.com/questions/5675459/how-to-get-java-version-from-batch-script
|
|
|
|
for /f "tokens=3" %%g in ('java -version 2^>^&1 ^| findstr /i "version"') do (
|
|
|
|
@echo Output: %%g
|
|
|
|
set JAVAVER=%%g
|
|
|
|
)
|
|
|
|
set JAVAVER=%JAVAVER:"=%
|
|
|
|
|
|
|
|
for /f "delims=. tokens=1-3" %%v in ("%JAVAVER%") do (
|
|
|
|
set MAJOR=%%v
|
|
|
|
set MINOR=%%w
|
|
|
|
set BUILD=%%x
|
|
|
|
)
|
|
|
|
|
2022-05-08 00:32:30 +00:00
|
|
|
:: Ensure java 17
|
2022-05-08 19:39:14 +00:00
|
|
|
if "%MAJOR%" NEQ "17" (
|
2022-05-08 00:32:30 +00:00
|
|
|
echo =======================================================================================
|
|
|
|
echo !! Java version is not 17 !!
|
|
|
|
echo Please download Java 17 or later to ensure %BRANCH% branch server launches correctly.
|
|
|
|
echo =======================================================================================
|
|
|
|
exit /b
|
2022-05-03 05:00:55 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
echo Java version is compatible
|