Printing java command line flags

Just a quickie as I often forget this for some reason. If you need to obtain a particular switch, whether the default or as configured in a running process, what is below will get it for you. Normally, outside of the default you will see it in the running process command line since it has been overridden. However, what is below will get it both ways.

Default…

-bash-4.1$ /usr/java/jdk1.7.0_67/bin/java -XX:+UnlockDiagnosticVMOptions -XX:+PrintFlagsFinal -version | grep NewRatio
     intx NewRatio                                  = 2               {product}
java version "1.7.0_67"
Java(TM) SE Runtime Environment (build 1.7.0_67-b01)
Java HotSpot(TM) 64-Bit Server VM (build 24.65-b04, mixed mode)
-bash-4.1$ 

…and for a running process…

-bash-4.1$ /usr/java/jdk1.7.0_67/bin/jinfo -flag NewRatio 6891
-XX:NewRatio=2
-bash-4.1$

1 comment for “Printing java command line flags

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.