@echo off
::consider using %dp0 instead of %T3Q_HOME%
if "%T3Q_HOME%" == "" (
    echo T3Q_HOME environment variable not set! It must point to the T3Q 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=%T3Q_HOME%\lib\com.yourkit.javaprofiler.controller_7.0.4.jar
set CLASSPATH=%CLASSPATH%;%T3Q_HOME%\lib\de.ugoe.cs.swe.trex.antlr_2.7.6.jar
set CLASSPATH=%CLASSPATH%;%T3Q_HOME%\lib\org.eclipse.core.resources_3.4.0.v20080604-1400.jar
set CLASSPATH=%CLASSPATH%;%T3Q_HOME%\lib\org.eclipse.core.runtime_3.4.0.v20080512.jar
set CLASSPATH=%CLASSPATH%;%T3Q_HOME%\lib\org.eclipse.equinox.common_3.4.0.v20080421-2006.jar
set CLASSPATH=%CLASSPATH%;%T3Q_HOME%\lib\org.eclipse.osgi_3.4.0.v20080605-1900.jar
set CLASSPATH=%CLASSPATH%;%T3Q_HOME%\lib\stringtemplate.jar
set CLASSPATH=%CLASSPATH%;%T3Q_HOME%\lib\xpp3_min-1.1.4c.jar
set CLASSPATH=%CLASSPATH%;%T3Q_HOME%\lib\xstream-1.3.1.jar
set CLASSPATH=%CLASSPATH%;%T3Q_HOME%\lib\commons-cli-1.2.jar

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

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

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

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

set JAVA_CMD=%JAVA% -Xmx512m -cp "%CLASSPATH%" org.etsi.t3q.T3Q 

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

