#! /bin/bash
if [ ! -d $1 ]; then 
  echo "USAGE : run_matlab.sh MATLAB_BIN_DIRECTORY"
  exit -1
fi

cd "$1"

for index in $(seq 1 $SQUISH_JAVA_DEF_COUNT); 
do
	if [[ $index -eq 1 ]]; then
		 rm -f java.opts
		 touch java.opts
	fi
	varname="SQUISH_JAVA_DEF_$index"
	echo>>java.opts "${!varname}"
done
echo>>java.opts "-Dsquish.bcel=$SQUISH_PREFIX/lib/bcel.jar"
echo>>java.opts "-Djava.security.policy=file:/tmp/frogtemp/squish.policy"
QT_PLUGIN_PATH=$QT_PLUGIN_PATH:$SQUISH_PREFIX/lib/plugins
./matlab -nosplash -desktop


