@ECHO OFF

REM rebuild system path for EMS CD installer
CALL .\scripts\pathenv.bat 2>NUL

REM EMS has installed and created java environment
CALL .\scripts\jenv.bat 2>NUL
IF NOT "%JRE_PATH%" == "" (
    START javaw -classpath .\lib\EMS.jar;.\lib\Mail.jar com.ctcu.nms.setup.SetupTool -lang EN
    GOTO END	
)

REM find java path in case of system path has no java path
CALL .\scripts\jenv2.bat 2>NUL
IF "%javaHome%" == "" (
    GOTO ERROR
)

ECHO.
ECHO Check java environment...
ECHO Java version... %javaVersion%.
ECHO Java JRE path... %javaHome%.
ECHO.
ECHO Configure EMS settings... 

REM CD installer will check CD property after executing the start program. 
javaw -classpath .\lib\EMS.jar;.\lib\Mail.jar com.ctcu.nms.setup.SetupTool -lang EN
GOTO END


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

:END


