Profile Image
vishnupriya

What is JVM startup parameter: -XX:+PrintCommandLineFlags?

What is JVM startup parameter: -XX:+PrintCommandLineFlags? Have you used this JVM arguement before? What are the pros & cons of using this Java argument? Can you share your perspective/experience in using this JVM argument?

  • jvmargument

  • xx-printcommandlineflags

  • x-printcommandlineflags

  • JVM startup parameter

Please Sign In or to post your comment or answer

Profile Image

Pavel Khodakovsky

Usage:


 This flag enables displaying of JVM arguments that appeared on the startup command.

 

Since:

 

Starting from JDK 6.

 

Examples:

 

To enable the display of the flag:

 

java -XX:+PrintCommandLineFlags MainClass

 

Description:

 

The JVM argument “PrintCommandLineFlags” can be quite useful. This parameter causes the JVM to print out the names and values ​​of the detailed JVM parameters (XX) that have been set by the user or by the JVM. In other words, it enumerates the parameters with ":=" in the third column of the result of “-XX:+PrintFlagsFinal”. In this way, we can use “-XX:+PrintCommandLineFlags” as a shortcut to view the modified parameters. See the example below.

 

java -XX:+PrintCommandLineFlags -version

As we can see, the JVM displayed to us the following used flags with their values:

 

-XX:G1ConcRefinementThreads=10 -XX:GCDrainStackTargetSize=64 -XX:InitialHeapSize=261411712 -XX:MaxHeapSize=4182587392 -XX:+PrintCommandLineFlags -XX:ReservedCodeCacheSize=251658240 -XX:+SegmentedCodeCache -XX:+UseCompressedClassPointers -XX:+UseCompressedOops -XX:+UseG1GC

 

Now if we set “-XX:+PrintCommandLineFlags” every time we start the java program and output it to the log file, it will record the impact of the JVM parameters we set on the application performance.

 

Default Value:

 

By default, this flag is disabled.

 

Note:

 

I suggest that the -XX:+PrintCommandLineFlags parameter should always be set in the JVM startup configuration. Because you never know when you'll need this information.

 

Arguments related:

 

PrintFlagsFinal

 

Related Posts:

 

Got something else on mind? Post Your Question

Not the answer you're looking for? Browse other questions tagged
  • jvmargument

  • xx-printcommandlineflags

  • x-printcommandlineflags

  • JVM startup parameter