1 #!/bin/sh 2 # 3 # Run the code in a classes directory on a host-local reference virtual 4 # machine. The jar should contain a top-level class named Main to run. 5 # 6 # Options: 7 # --quiet -- don't chatter 8 # --debug -- wait for debugger to attach 9 # --no-verify -- turn off verification (on by default) 10 # --dev -- development mode 11 12 msg() { 13 if [ "$QUIET" = "n" ]; then 14 echo "$@" 15 fi 16 } 17 18 DEBUG="n" 19 QUIET="n" 20 VERIFY="y" 21 22 while true; do 23 if [ "x$1" = "x--quiet" ]; then 24 QUIET="y" 25 shift 26 elif [ "x$1" = "x--debug" ]; then 27 DEBUG="y" 28 shift 29 elif [ "x$1" = "x--no-verify" ]; then 30 VERIFY="n" 31 shift 32 elif [ "x$1" = "x--dev" ]; then 33 # not used; ignore 34 shift 35 elif [ "x$1" = "x--" ]; then 36 shift 37 break 38 elif expr "x$1" : "x--" >/dev/null 2>&1; then 39 echo "unknown option: $1" 1>&2 40 exit 1 41 else 42 break 43 fi 44 done 45 46 if [ "$VERIFY" = "y" ]; then 47 VERIFY_ARG="-Xverify:all" 48 msg "Performing verification" 49 else 50 VERIFY_ARG="-Xverify:none" 51 msg "Skipping verification" 52 fi 53 54 if [ "$DEBUG" = "y" ]; then 55 PORT=8000 56 msg "Waiting for debugger to connect on localhost:$PORT" 57 DEBUG_OPTS="-agentlib:jdwp=transport=dt_socket,address=$PORT,server=y,suspend=y" 58 fi 59 60 ${JAVA} ${DEBUG_OPTS} -ea ${VERIFY_ARG} -classpath classes Main "$@" 61