#!/bin/bash

help() {
  echo "usage: $(basename $0) jdkprog arguments"
  echo "  e.g. >$(basename $0) javac DefineModels"
  echo "  e.g. >$(basename $0) java DefineTransformations"
  exit
}

if [ "$1" = "-h" -o -z "$1" ]; then
  help
fi

EXECDIR=$(dirname $0)

if [ -d $EXECDIR/../../distjar ]; then
#updated by nick 22/8/03 to add templates and oldgui difrectory to classpath
  CLASSPATH=$EXECDIR:$EXECDIR/../../classes:$EXECDIR/../templates:$EXECDIR/../oldgui
  for i in $EXECDIR/../../distjar/*.jar; do
    CLASSPATH=$CLASSPATH:$i
  done
else
#updated by nick 22/8/03 to add templates and oldgui directory to classpath
  CLASSPATH=$EXECDIR:$EXECDIR/../templates:$EXECDIR/../oldgui
  for i in $EXECDIR/../../jar/*.jar; do
    CLASSPATH=$CLASSPATH:$i
  done   
fi

export CLASSPATH
echo $CLASSPATH

exec "$@"
