Friday, July 29, 2016

How to view your JVM default settings


public class Test {
   public static void main(String[] args) {
        for (;;) {



java -XX:+PrintCommandLineFlags Test
you should get something like this:
-XX:InitialHeapSize=67108864 -XX:MaxHeapSize=1073741824 -XX:+PrintCommandLineFlags -XX:+UseParallelGC

1 comment:

Taimo Peelo said...

No need for Test class to exist, one can use -version switch or supply whatever (non-existing) class name to java, e.g.:

$ java -XX:+PrintCommandLineFlags -version

-XX:InitialHeapSize=194891840 -XX:MaxHeapSize=3118269440 -XX:+PrintCommandLineFlags -XX:+UseCompressedClassPointers -XX:+UseCompressedOops -XX:+UseParallelGC

java version "1.8.0_101"

Java(TM) SE Runtime Environment (build 1.8.0_101-b13)

Java HotSpot(TM) 64-Bit Server VM (build 25.101-b13, mixed mode)

For extra details, the -XX:+PrintFlagsFinal is also interesting flag :)