@echo off
if "%OS%" == "Windows_NT" setlocal

REM ------------- set GPSS Home --------------------------------------
REM set GPSS_HOME=

REM ------------- set GPSS Option ------------------------------------
set GPSS_OPT=
if not "%GPSS_HOME%" == "" set GPSS_OPT=-Dgpss.home="%GPSS_HOME%"
if not "%JAVA_HOME%" == "" goto gotJavaHome
echo You must set JAVA_HOME to point at your Java Development Kit installation
pause
goto eof
:gotJavaHome

if exist "%JAVA_HOME%\jre" goto setJREServerJVM
set __SERVER_JVM_PATH=%JAVA_HOME%\bin\server
goto checkServerJVM

:setJREServerJVM
set __SERVER_JVM_PATH=%JAVA_HOME%\jre\bin\server

:checkServerJVM
if exist "%__SERVER_JVM_PATH%" goto setServerOption
echo Use Java HotSpot Client VM
goto setClasspath

:setServerOption
set GPSS_OPT=%GPSS_OPT% -server
echo Use Java HotSpot Server VM

REM ------------- set classpath --------------------------------------
:setClasspath
set GPSS_CP=./gpss.jar

set GPSS_CP=%GPSS_CP%;./classes
set GPSS_CP=%GPSS_CP%;./lib/log4j-1.2.8.jar
set GPSS_CP=%GPSS_CP%;./lib/commons-beanutils.jar
set GPSS_CP=%GPSS_CP%;./lib/commons-collections.jar
set GPSS_CP=%GPSS_CP%;./lib/commons-digester.jar
set GPSS_CP=%GPSS_CP%;./lib/commons-logging.jar
set GPSS_CP=%GPSS_CP%;./lib/commons-pool-1.1.jar
set GPSS_CP=%GPSS_CP%;./lib/xmlParserAPIs.jar
set GPSS_CP=%GPSS_CP%;./lib/js.jar
set GPSS_CP=%GPSS_CP%;./lib/concurrent.jar

set GPSS_CP=%GPSS_CP%;./lib/jdom.jar

%JAVA_HOME%\bin\java %GPSS_OPT% -cp %GPSS_CP% jp.wda.gpss.system.Main config.xml

:eof
