@ECHO OFF

CD %~DP0

CD .\EMS
CALL .\scripts\jenv2.bat 2>NUL
IF "%javaVersion%" == "" (
    GOTO ERROR	
)
IF "%javaHome%" == "" (
    GOTO ERROR
)

ECHO.
ECHO Check java environment...
ECHO Java version... %javaVersion%.
ECHO Java JRE path... %javaHome%.
ECHO EMS installation path... %emsPath%.
ECHO.

START javaw -classpath .\lib\EMS.jar com.ctcu.nms.setup.UpgradeTool %emsPath% -lang EN
GOTO END

:ERROR
    ECHO.
    ECHO Java JRE not found! Please check if JAVA is installed?
    ECHO.
    PAUSE
    
:END
    