Created
June 8, 2011 17:47
-
-
Save vshank77/1014913 to your computer and use it in GitHub Desktop.
Simple appstart shell
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| MAIN_CLASS= | |
| # OS specific support | |
| cygwin=false | |
| os400=false | |
| darwin=false | |
| case "`uname`" in | |
| CYGWIN*) cygwin=true;; | |
| OS400*) os400=true;; | |
| Darwin*) darwin=true;; | |
| esac | |
| # Resolve links | |
| PRG="$0" | |
| while [ -h "$PRG" ]; do | |
| ls=`ls -ld "$PRG"` | |
| link=`expr "$ls" : '.*-> \(.*\)$'` | |
| if expr "$link" : '/.*' > /dev/null; then | |
| PRG="$link" | |
| else | |
| PRG=`dirname "$PRG"`/"$link" | |
| fi | |
| done | |
| PRGDIR=`dirname "$PRG"` | |
| PRG_HOME=`cd "$PRGDIR/.." >/dev/null; pwd` | |
| # Set Java runtime | |
| if $os400; then | |
| BASEDIR="$PRG_HOME" | |
| . "$PRG_HOME"/bin/setjava.sh | |
| else | |
| if [ -r "$PRG_HOME"/bin/setjava.sh ]; then | |
| BASEDIR="$PRG_HOME" | |
| . "$PRG_HOME"/bin/setjava.sh | |
| else | |
| echo "Cannot find $PRG_HOME/bin/setjava.sh" | |
| echo "This file is needed to run this program" | |
| exit 1 | |
| fi | |
| fi | |
| # Set classpath | |
| CLASSPATH="$PRG_HOME"/lib/properties:`ls -d "$PRG_HOME"/lib/* | awk '{a[NR+1]=$1}NR>1{printf a[NR]":"}END{print $1}'` | |
| if $cygwin; then | |
| CLASSPATH=`cygpath --path --windows "$CLASSPATH"` | |
| fi | |
| # Get all the args | |
| VM_OPTS= | |
| if [ -r "$PRG_HOME"/etc/vmargs.file ]; then | |
| VM_OPTS=`awk '{a[NR+1]=$1}NR>1{printf a[NR]" "}END{print $1}' "$PRG_HOME"/etc/vmargs.file` | |
| fi | |
| JAVA_OPTS= | |
| if [ -r "$PRG_HOME"/etc/sysargs.properties ]; then | |
| JAVA_OPTS=`awk '{a[NR+1]=$1}NR>1{printf a[NR]" "}END{print $1}' "$PRG_HOME"/etc/sysargs.properties` | |
| fi | |
| eval \"$_RUNJAVA\" $VM_OPTS $JAVA_OPTS -classpath \"$CLASSPATH\" $MAIN_CLASS "$@" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment