#!/bin/sh
#
# NOTE: java -cp simdiff4.jar does not inherit the same classpath as java -jar simdiff4.jar, so we have to explicitly define the
#       full classpath in order for MATLAB integration to work.

# Use readlink to resolve the script's location.  This resolves symlinks, and converts relative paths to absolute paths.
SCRIPT_PATH=`readlink -f "$0"`;

# Get the SimDiff installation directory (assumed to be the location of this script)
SIMDIFF_DIR=`dirname "$SCRIPT_PATH"`;

export PATH="$SIMDIFF_DIR/jre/bin:$PATH";
export LD_LIBRARY_PATH="$SIMDIFF_DIR/lib";
export CLASSPATH="`find "$SIMDIFF_DIR/lib" -name "*.jar" -printf %p:`";


"$SIMDIFF_DIR/jre/bin/java" -Dcom.simdiff4.commandline -Dcom.simdiff4.installdir="$SIMDIFF_DIR" -Djava.library.path="$SIMDIFF_DIR/lib" -Xmx4096m -classpath "$CLASSPATH" com.ensoftcorp.product.simmerge.SimMerge "$@"
