@echo off

set OLD_DIR=%cd%
chdir /D %~f0\..\..

set POSEIDON_HOME=%cd%

if defined JAVA_HOME (
  goto :START_POSEIDON
)

if exist "%POSEIDON_HOME%\jre" (
  set JAVA_HOME=%POSEIDON_HOME%\jre
  goto :START_POSEIDON
)

rem ***if no JAVA_HOME could be set***
title JAVA_HOME is not set
echo.
echo Could not find a JDK.
echo Either you have to install JDK 1.4,
echo or you have to set JAVA_HOME to your JDK installation directory.
echo.
pause
goto :END



:START_POSEIDON

set JAVACMD=java
set OLD_PATH=%PATH%
set PATH=%JAVA_HOME%\bin;%PATH%

set CLASSPATH=.\lib\concurrent_license_server.jar;.\lib\enterprise.jar;.\lib\poseidon2.jar;.\lib\uml14.jar
set CLASSPATH=%CLASSPATH%;%JAVA_HOME%\jre\lib\rt.jar

echo Classpath is %CLASSPATH%.

%JAVACMD% -Xms64m -Xmx384m -Dorg.xml.sax.driver=org.apache.xerces.parsers.SAXParser -Dposeidon.java.home="%JAVA_HOME%" -Dposeidon.user.dir.CE="%POSEIDONCE_HOME%" com.gentleware.poseidon.Poseidon %*


:End
set PATH=%OLD_PATH%
chdir %OLD_DIR%
title %cd%


