Search

Run jar with options

Run jar
java -jar myJar.jar

Run with JVM memory options
java -Xmx300m -Xms300m -myJar.jar

Run with JVM options for remote jconsole monitoring (java 1.6)
java -Dcom.sun.management.
jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.port=8082 -jar myJar.jar
 
-Xmx300m set maximum heam size to 300 MB (use "k" for KB)
-Xmx300m set starting heap size to 300 MB (use "k" for KB)
Note: in this example we disable authentication. Follow this link
http://docs.oracle.com/javase/6/docs/technotes/guides/management/agent.html#gdeup
to configure password and access files.
Note: in Ubuntu server we have to set the system's host name with machine ip
hostname [machineIp]

Full optional example
java -Xmx300m -Xms300m -Dcom.sun.management.
jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.port=8082 -jar myTest.jar 

No comments:

Post a Comment