How to check the Java JVM Options
As Java developers, we often need to check what flags & properties are being used by our JVM, in this quick post I will show you the different ways to get this information using the JDK commands.
What options are available to my JVM?
First of all, there are a lot of options, and they vary from platform to platform. Let’s see what options or flags are available to our specific JVM (some options and values could be different on different platforms), you can see the full list with the following two commands:
java -XX:+PrintFlagsFinal -version
or if you have a JVM running and you know the PID, you can also use the following command:
jcmd 20248 VM.flags -all
This will print the entire list of JVM options and their default values, what is interesting from the list, is that some of them are “manageable”.
Manageable JVM Options
Running the above’s command, you will see some that, in the last column have the “manageable” value, that means that the value can be changed dynamically during runtime.
jcmd 20248 VM.flags -all | grep manageable
To change them, we can use the jinfo command, let’s see how we can change the value of the…