@echo off

set DEFAULT_JAVA_HOME=C:\Program Files\Java\jdk1.5.0_02

set OLDCLASSPATH=%CLASSPATH%
set OLDPATH=%PATH%

set OLDJAVA_HOME=%JAVA_HOME%

if not "%JAVA_HOME%" == "" if exist "%JAVA_HOME%\bin" goto gotJavaHome
set JAVA_HOME=%DEFAULT_JAVA_HOME%
set PATH=%JAVA_HOME%\bin;%PATH%

if not "%JAVA_HOME%" == "" if exist "%JAVA_HOME%\bin" goto gotJavaHome
echo JAVA HOME set to %JAVA_HOME%
echo ERROR: JAVA_HOME not set correctly. Edit this script and set JAVA_HOME to point at your Java Development Kit installation
goto error

:gotJavaHome
echo JAVA HOME set to %JAVA_HOME%
if exist "%JAVA_HOME%\lib\tools.jar" goto okTools
echo ERROR: Unable to locate tools.jar.
goto error
:okTools

set CLASSPATH=
set CLASSPATH=%CLASSPATH%;%JAVA_HOME%\lib\tools.jar

set CLASSPATH=%CLASSPATH%;..\bin\abalib.jar
set CLASSPATH=%CLASSPATH%;..\bin\abadc.jar
set CLASSPATH=%CLASSPATH%;..\bin\EXML.jar
set CLASSPATH=%CLASSPATH%;..\bin\cf.jar
set CLASSPATH=%CLASSPATH%;..\bin\cbeans.jar
set CLASSPATH=%CLASSPATH%;..\bin\cutils.jar
set CLASSPATH=%CLASSPATH%;..\bin\ozten.jar
set CLASSPATH=%CLASSPATH%;..\bin\rowset.jar
set CLASSPATH=%CLASSPATH%;..\bin\swingset-bin_0.7.0_beta.jar
set CLASSPATH=%CLASSPATH%;..\bin\mysql-connector-3.0.14.jar
set CLASSPATH=%CLASSPATH%;..\bin\janino.jar
set CLASSPATH=%CLASSPATH%;..\bin\looks-1.1.3.jar
set CLASSPATH=%CLASSPATH%;..\bin\mssqlserver.jar;..\bin\msbase.jar;..\bin\msutil.jar
set CLASSPATH=%CLASSPATH%;..\bin\customcomponents\abaguicustom.jar
set CLASSPATH=%CLASSPATH%;..\bin\customcomponents\dev.customcomponents.AbacusCustom.jar
set CLASSPATH=%CLASSPATH%;..\bin\customcomponents\jcommon-1.0.0-pre2.jar
set CLASSPATH=%CLASSPATH%;..\bin\customcomponents\jfreechart-1.0.0-pre2.jar
set CLASSPATH=%CLASSPATH%;..\samples\

set CLASSPATH=%CLASSPATH%;%1;%2;%3;%4;%5
set CLASSPATH=%CLASSPATH%;.

@echo on
"%JAVA_HOME%\bin\java.exe" -Xms128m -Xmx384m -Dch.abacus.renderer.devmode=on exec %1 
IF NOT ERRORLEVEL 1 GOTO end

:error
pause

:end
set CLASSPATH=%OLDCLASSPATH%
set PATH=%OLDPATH%

set JAVA_HOME=%OLDJAVA_HOME%
