rem ##### the "set JAVA_HOME..." line near the end of this file tells rem ##### the VMR CRE where you've installed Java. We try to find it. rem ##### but if all else fails, you can always just set it by rem ##### updating the path to the correct location. setlocal ENABLEEXTENSIONS set KEY_NAME="HKLM\SOFTWARE\JavaSoft\Java Runtime Environment" set VALUE_NAME=CurrentVersion :: :: get the current version :: FOR /F "usebackq skip=2 tokens=3" %%A IN (`REG QUERY %KEY_NAME% /v %VALUE_NAME% 2^>nul`) DO ( set ValueValue=%%A ) if defined ValueValue ( @echo the current Java runtime is %ValueValue% ) else ( @echo %KEY_NAME%\%VALUE_NAME% not found. mshta "javascript:var sh=new ActiveXObject( 'WScript.Shell' ); sh.Popup( 'Java 8 not found. Please install java from: http://java.oracle.com', 10, 'VMR CRE Error', 64 );close();" goto end ) set JAVA_CURRENT="HKLM\SOFTWARE\JavaSoft\Java Runtime Environment\%ValueValue%" set JAVA_HOME=JavaHome :: :: get the javahome :: FOR /F "usebackq skip=2 tokens=3*" %%A IN (`REG QUERY %JAVA_CURRENT% /v %JAVA_HOME% 2^>nul`) DO ( set JAVA_PATH=%%A %%B ) echo the path of the current Java JVM according to the registry is echo %JAVA_PATH% echo. echo now if we try it : "%JAVA_PATH%\bin\java.exe" -version set "JAVA_HOME=%JAVA_PATH%" if "%JAVA_HOME%" == "" ( set "JAVA_HOME=C:\Program Files\Java\jdk1.8.0_102" ) set CATALINA_HOME=tomcat-7.0.62 call tomcat-7.0.62\bin\startup.bat mshta "javascript:var sh=new ActiveXObject( 'WScript.Shell' ); sh.Popup( 'The VMR CRE Portal is spinning up. This might take a minute or two.', 10, 'VMR CRE Starting...', 64 );close();" :end