Last active
April 20, 2017 12:13
-
-
Save TheAshwanik/8773358 to your computer and use it in GitHub Desktop.
Basic Shell Script to start JAVA
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 | |
| BIN_DIR=`dirname "$0"` | |
| BIN_DIR=`( cd "$BIN_DIR" && pwd)` | |
| cd $BIN_DIR/.. | |
| # memory settings | |
| HEAP_OPTS="-Xms64m -Xmx512m -XX:PermSize=32m -XX:MaxPermSize=128m" | |
| # enable remote JMX monitoring | |
| JMX_OPTS="-Dcom.sun.management.jmxremote.port=9988 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false" | |
| # garbage collection | |
| GC_OPTS="-XX:+UseConcMarkSweepGC -XX:+UseParNewGC" | |
| # debugging | |
| DEBUG_OPTS="-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=logs -XX:ErrorFile=logs/server_java_error%p.log" | |
| # remote debugging | |
| #DEBUG_OPTS="$DEBUG_OPTS -Xdebug -Xrunjdwp:transport=dt_socket,address=9090,server=y,suspend=n" | |
| JAVA_OPTS="-server -Dfile.encoding=UTF-8 $GC_OPTS $HEAP_OPTS $JMX_OPTS $DEBUG_OPTS" | |
| CLASSPATH="lib/*:conf/*" | |
| java -cp $CLASSPATH $JAVA_OPTS com.foo.bar.Application |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment