@echo off

rem Default value
set RUNTIME_HOME=C:\aster\10.3\runtime\
rem %~dp0 is the local directory (where waster.bat lies)
if "%OS%"=="Windows_NT" set RUNTIME_HOME=%~dp0
rem setting default runtime 
set ASTER_CMD_LINE_ARGS=-defaultruntime %RUNTIME_HOME%
rem reading of all arguments
if ""%1""=="""" goto doneStart
rem shift
:setupArgs
if ""%1""=="""" goto doneStart
set ASTER_CMD_LINE_ARGS=%ASTER_CMD_LINE_ARGS% %1
shift
goto setupArgs
:doneStart

set LOGCHOICE=

set LOGLEVEL=

set LIBDIR=%RUNTIME_HOME%jar\

set LOCALCLASSPATH=%LIBDIR%waster-0.1.jar
set LOCALCLASSPATH=%LOCALCLASSPATH%;%LIBDIR%commons-cli-1.2.jar
set LOCALCLASSPATH=%LOCALCLASSPATH%;%LIBDIR%commons-exec-1.0.1.jar
set LOCALCLASSPATH=%LOCALCLASSPATH%;%LIBDIR%commons-io-1.4.jar

set JAVAOPTS=-Denv.windir=%WINDIR%

if "%JAVA_HOME%" == "" goto noJavaHome
if not exist "%JAVA_HOME%\bin\java.exe" goto noJavaHome
if "%JAVACMD%" == "" set JAVACMD=%JAVA_HOME%\bin\java
goto runAster

:noJavaHome
if "%JAVACMD%" == "" set JAVACMD=java

:runAster
rem ECHO "%JAVACMD%"
"%JAVACMD%" %JAVAOPTS% %LOGCHOICE% %LOGLEVEL% -cp "%LOCALCLASSPATH%" com.pimeca.waster.Cli %ASTER_CMD_LINE_ARGS%

