#!/bin/csh

# --------------------
# Find out J_HOME
# --------------------
set J_BIN=`which java`
if ($status != 0) then
   echo "------------------------------------------------------------"
   echo "ERROR: Command 'java' not found. Please add it to your path."
   exit 5
endif

# --------------------
# Find out PROGDIR
# --------------------
set BINDIR=`dirname $0`
if ($BINDIR == ".") set BINDIR = `pwd`
set PROGDIR=`dirname $BINDIR`

# --------------------
# Set variables to use
# --------------------
set J_BIN_DIR=`dirname $J_BIN`
set J_HOME=`dirname $J_BIN_DIR`

# --------------------
# Check CLASSPATH
# --------------------
if (! $?CLASSPATH) then
   set CLASSPATH
endif

# --------------------
# Execute Java runtime
# --------------------
${J_HOME}/bin/java -mx128m -classpath $J_HOME/lib/tools.jar:$PROGDIR/lib/Jedi.jar:$PROGDIR/lib/JavaGPE.jar de.hillenbrand.jedi.JediPrefsFrame

# --------------------
# Check exit status
# --------------------
if ($status != 0) then
   echo "--------------------------------------------------------------------"
   echo "ERROR: Something went wrong while starting  or  running the program."
   echo "       Please make sure that you are using the correct java version."
endif
