optimize JDK version checking in Win OS (#41)
authorXiangdong Huang <hxdreg@qq.com>
Thu, 14 Feb 2019 09:07:36 +0000 (17:07 +0800)
committerGitHub <noreply@github.com>
Thu, 14 Feb 2019 09:07:36 +0000 (17:07 +0800)
optimize start-server.bat to adapt jdk version like '11+28'

iotdb/iotdb/bin/start-server.bat

index abf9ebc..2077797 100755 (executable)
@@ -23,18 +23,24 @@ echo Starting IoTDB
 echo ````````````````````````
 
 PATH %PATH%;%JAVA_HOME%\bin\
-for /f tokens^=2-5^ delims^=.-_^" %%j in ('java -fullversion 2^>^&1') do (
-               set "FULL_VERSION=%%j%%k%%l%%m"
-               set "MAJOR_VERSION=%%j"
-               set "MINOR_VERSION=%%k"
+set "FULL_VERSION="
+set "MAJOR_VERSION="
+set "MINOR_VERSION="
+
+
+for /f tokens^=2-5^ delims^=.-_+^" %%j in ('java -fullversion 2^>^&1') do (
+       set "FULL_VERSION=%%j-%%k-%%l-%%m"
+       IF "%%j" == "1" (
+           set "MAJOR_VERSION=%%k"
+           set "MINOR_VERSION=%%l"
+       ) else (
+           set "MAJOR_VERSION=%%j"
+           set "MINOR_VERSION=%%k"
        )
-
-IF "%MAJOR_VERSION%" == "1" (
-       set JAVA_VERSION=%MINOR_VERSION%
-) else (
-       set JAVA_VERSION=%MAJOR_VERSION%
 )
 
+set JAVA_VERSION=%MAJOR_VERSION%
+
 IF NOT %JAVA_VERSION% == 8 (
        IF NOT %JAVA_VERSION% == 11 (
                echo IoTDB only supports jdk8 or jdk11, please check your java version.