@echo off

if "%T3D_HOME%" == "" (
    echo T3D_HOME environment variable not set! It must point to the T3D installation directory!
    goto:eof
)

if "%JAVA_HOME%" == "" (
    echo JAVA_HOME environment variable not set! It must point to the directory of your Java Runtime >= 5.0
    goto:eof
)

setlocal
set CLASSPATH=%T3D_HOME%\lib\com.yourkit.javaprofiler.controller_7.0.4.jar
set CLASSPATH=%CLASSPATH%;%T3D_HOME%\lib\de.ugoe.cs.swe.trex.antlr_2.7.6.jar
set CLASSPATH=%CLASSPATH%;%T3D_HOME%\lib\org.eclipse.core.resources_3.4.0.v20080604-1400.jar
set CLASSPATH=%CLASSPATH%;%T3D_HOME%\lib\org.eclipse.core.runtime_3.4.0.v20080512.jar
set CLASSPATH=%CLASSPATH%;%T3D_HOME%\lib\org.eclipse.equinox.common_3.4.0.v20080421-2006.jar
set CLASSPATH=%CLASSPATH%;%T3D_HOME%\lib\org.eclipse.osgi_3.4.0.v20080605-1900.jar
set CLASSPATH=%CLASSPATH%;%T3D_HOME%\lib\stringtemplate.jar
set CLASSPATH=%CLASSPATH%;%T3D_HOME%\lib\xpp3_min-1.1.4c.jar
set CLASSPATH=%CLASSPATH%;%T3D_HOME%\lib\xstream-1.3.1.jar
set CLASSPATH=%CLASSPATH%;%T3D_HOME%\lib\fop.jar
set CLASSPATH=%CLASSPATH%;%T3D_HOME%\lib\commons-logging-1.1.1.jar
set CLASSPATH=%CLASSPATH%;%T3D_HOME%\lib\commons-io-1.4.jar
set CLASSPATH=%CLASSPATH%;%T3D_HOME%\lib\commons-lang-2.4.jar
set CLASSPATH=%CLASSPATH%;%T3D_HOME%\lib\commons-cli-1.2.jar
set CLASSPATH=%CLASSPATH%;%T3D_HOME%\lib\batik-util.jar
set CLASSPATH=%CLASSPATH%;%T3D_HOME%\lib\saxon9.jar

set JAVA="%JAVA_HOME%\bin\java.exe"

if exist "%T3D_HOME%\..\de.ugoe.cs.swe.trex.core\bin\de" (
    set CLASSPATH=%CLASSPATH%;%T3D_HOME%\..\de.ugoe.cs.swe.trex.core\bin
) else (
    set CLASSPATH=%CLASSPATH%;%T3D_HOME%\lib\de.ugoe.cs.swe.trex.core_0.6.0.200810271154.jar
)

if exist "%T3D_HOME%\..\org.etsi.common\bin\org" (
    set CLASSPATH=%CLASSPATH%;%T3D_HOME%\..\org.etsi.common\bin
) else (
    set CLASSPATH=%CLASSPATH%;%T3D_HOME%\lib\org.etsi.common.jar
)

if exist "%T3D_HOME%\bin\org" (
    set CLASSPATH=%CLASSPATH%;%T3D_HOME%\bin
) else (
    set CLASSPATH=%CLASSPATH%;%T3D_HOME%\lib\t3d.jar
)

set JAVA_CMD=%JAVA% -Xmx512m -Xss128m -cp "%CLASSPATH%" org.etsi.t3d.T3D

if "%1" == "--echo" (
	echo %JAVA_CMD%
) else (
	%JAVA_CMD% %*
)

