#!/bin/ksh

###########################################################
# this expects as first paramter the main class to start
# additional parameter will be considered as program parameters
# note that the first two parameters are always the configtool confiruation
# properties and the pcdstartup.properties, so your program-specific paramters
# will start with the third parameter
###########################################################

# title Offline PCD Expert Checktool

if [ -z "${JAVA_HOME}" ] 
then
  echo "ERROR Environment Variable JAVA_HOME not set"
  exit 1
fi

# in order to enable remote debugging, please uncomment the following line
# DEBUG=-agentlib:jdwp=transport=dt_socket,server=y,address=8000,suspend=y

echo "Starting up"

./copyLibUnix.sh

if  [ $? -eq 0 ] 
then
    echo "Copylibs ok"
  else
    echo "Copylibs faile"
    exit 1
fi

if [ $1 -eq ]
  then
    echo "Please provide a configuration file as parameter or use one of the configured Batch files in this directory"
    exit 1
fi

echo Starting Console...

"${JAVA_HOME}/bin/java" -Xmx1024m $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

