@echo off

set DEFAULT_JAVA_HOME=C:\Programs\OpenJDK

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

@echo on
"%JAVA_HOME%\bin\java.exe" ch.abacus.designcockpit.ide.DesignCockpit
IF NOT ERRORLEVEL 1 GOTO end

:error
pause

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

set JAVA_HOME=%OLDJAVA_HOME%
