#!/bin/sh

# To understand this, read 'man sh' below "substring processing".
# This can also be accomplished with the 'dirname' command,
# but it may not be installed.
here="${0%/*}"

# This should be the name of your native Java-app's executable.
cmd='JavaApplicationStub'

# Set all desired soft-limits here.  See 'ulimit' in 'man sh'.
#ulimit -S -n 1000

#export JAVA_HOME=/Library/Java/Home	#Not needed, in principle
export R_HOME=/Library/Frameworks/R.framework/Resources
#export LD_LIBRARY_PATH=${R_HOME}/lib:${R_HOME}/bin:${JAVA_HOME}/jre/lib/i386/client:${JAVA_HOME}/jre/lib/i386:${JAVA_HOME}/jre/../lib/i386:/usr/java/packages/lib/i386:/lib:/usr/lib:${R_HOME}/library/rJava/jri:$LD_LIBRARY_PATH

# Execute the Java-app in the current process.  See 'exec' in 'man sh'.
exec "$here/$cmd" "$@"