Permalink
Browse files

Update javaDetect.bat

  • Loading branch information...
npocmaka committed Apr 7, 2016
1 parent 2c45197 commit 17c9d24fbc8e282862a15d44ddad656a9015868e
Showing with 10 additions and 8 deletions.
  1. +10 −8 Java/javaDetect.bat
View
@@ -1,6 +1,6 @@
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
@ECHO OFF
set __COMPAT_LAYER=RunAsInvoker
:: Export java settings from registry to a temporary file
START /W REGEDIT /E %Temp%\java.reg "HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft"
@@ -25,16 +25,18 @@ SET JAVA_HOME=%JAVA_HOME:\\=\%
SET JAVA_HOME
:: Get java version
FOR /F "tokens=1* delims==" %%A IN ('TYPE %Temp%\java.reg ^| FIND "CurrentVersion"') DO SET JAVA_VERSION=%%B
SET JAVA_VERSION=%JAVA_VERSION:"=%
SET JAVA_VERSION
SET JAVA_VERSION=%JAVA_VERSION:.=%
SET JAVA_VERSION=%JAVA_VERSION:_=%
SET /A JAVA_VERSION=%JAVA_VERSION%
::FOR /F "tokens=1* delims==" %%A IN ('TYPE %Temp%\java.reg ^| FIND "CurrentVersion"') DO SET JAVA_VERSION=%%B
::SET JAVA_VERSION=%JAVA_VERSION:"=%
::SET JAVA_VERSION
::SET JAVA_VERSION=%JAVA_VERSION:.=%
::SET JAVA_VERSION=%JAVA_VERSION:_=%
::SET /A JAVA_VERSION=%JAVA_VERSION%
for /f tokens^=2-5^ delims^=.-_^" %%j in ('%JAVA_HOME%\bin\java.exe -fullversion 2^>^&1') do set "JAVA_VERSION=%%j%%k%%l%%m"
:: Delete temp file
rem @DEL %Temp%\java.reg /S /Q > NUL 2>&1
set JAVA_VERSION
:: Check java version compatibility
IF %JAVA_VERSION% LSS 16020 (
ECHO.

0 comments on commit 17c9d24

Please sign in to comment.