@echo off

rem this expects as first paramter the main class to start
rem additional parameter will be considered as program parameters
rem note that the first two parameters are always the configtool confiruation
rem properties and the pcdstartup.properties, so your program-specific paramters
rem will start with the third parameter

title Offline PCD Expert Checktool

rem in order to enable remote debugging, please uncomment the following line
rem set DEBUG=-agentlib:jdwp=transport=dt_socket,server=y,address=8000,suspend=y

call copyLib.bat
if %1"" == "" (
echo Please provide a configuration file as parameter or use one of the configured Batch files in this directory
pause
goto :eof
) 
echo Starting Console...
setlocal
if DEFINED SAPJVM_HOME (
  set JAVA_CMD="%SAPJVM_HOME%\bin\java"
) else if DEFINED JAVA_HOME (
  set JAVA_CMD="%JAVA_HOME%\bin\java"
) else (
  echo WARNING Environment variable SAPJVM_HOME or JAVA_HOME not set, try to launch java from current PATH
  set JAVA_CMD=java
)
%JAVA_CMD% -Xmx1024m -Djava.naming.factory.url.pkgs=com.sapportals.jndi.providers %DEBUG% -classpath .\sap.com~tc~bl~offline_launcher~impl.jar;. com.sap.engine.offline.OfflineToolStart %1 ./ ../configtool/config.properties ./pcdStartup.properties %2 %3 %4 %5
endlocal
if %errorlevel% NEQ 0 (
  echo Program terminated abnormally
  pause
) else (
  rem Program successfully finished
)
