Print All Jvm Flags

Print All JVM Flags

Do not miss also -XX:+JVMCIPrintProperties for Graal JIT options.

Before dive into sources you can skim over following extracts and find suitable option faster:

https://chriswhocodes.com/ (OracleJDK 6/7/8/9/10/11/12, OpenJDK 8/9/10/11, Graal CE/EE, OpenJ9, Zing)

http://jvm-options.tech.xebia.fr/

http://www.pingtimeout.fr/2012/05/jvm-options-complete-reference.html

http://stas-blogspot.blogspot.com/2011/07/most-complete-list-of-xx-options-for.html

Complete list of JVM options

You can use

java -XX:+UnlockDiagnosticVMOptions -XX:+PrintFlagsFinal -version

to print all options and their defaults. If you have a debug build you can use this command to print comments for the various options as well:

java -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -XX:+PrintFlagsFinal -XX:+PrintFlagsWithComments -version

PS: There are descriptions for most of them in this blog post: http://stas-blogspot.blogspot.bg/2011/07/most-complete-list-of-xx-options-for.html

How to get VM arguments from inside of Java application?

With this code you can get the JVM arguments:

import java.lang.management.ManagementFactory;
import java.lang.management.RuntimeMXBean;
...
RuntimeMXBean runtimeMxBean = ManagementFactory.getRuntimeMXBean();
List<String> arguments = runtimeMxBean.getInputArguments();

Within a running JVM, how to programmatically determine the jvm options used at startup?

You could use a JMX client (like VisualVM) and then call getVMOption(String name), see HotSpotDiagnosticMXBean.

Or, if you could pass in at least one set of flags to enable JVM logging, it should be --XX:+LogVMOutput -XX:LogFile=jvm.log and then parse the output of the log from your app. The log contains all the flags/parameters used to startup the JVM.

Another option is to list the JVM process started by PID with ps -ef and there you can see all the input argument of that process. That should work for any JVM type.

Find deprecated JVM flags

There are multiple "levels" of deprecation: ALIASED, DEPRECATED, OBSOLETE and EXPIRED flags with the meaning described in arguments.cpp.

Besides above categories, there are also deprecated tracing flags that are replaced with Unified JVM Logging options.

Finally, there are some flags not listed above that simply have "deprecated" in the description.

I'm not aware of a single place that collects all these deprecated flags together, but it's fairly easy to extract them from JVM sources: the mentioned arguments.cpp and globals*.hpp family. I also recommend VM Options Explorer site with well structured table of HotSpot JVM flags by version.

As of JDK 11, the list of deprecated/obsolete/expired and otherwise unsupported flags includes:

AggressiveOpts
AllowNonVirtualCalls
AssumeMP
CheckAssertionStatusDirectives
CheckEndorsedAndExtDirs
CompilerThreadHintNoPreempt
CreateMinidumpOnCrash
DefaultMaxRAMFraction
DeferPollingPageLoopCount
DeferThrSuspendLoopCount
EnableTracing
FastTLABRefill
FreqCountInvocations
IgnoreUnverifiableClassesDuringDump
InitialRAMFraction
InlineNotify
MaxGCMinorPauseMillis
MaxPermSize
MaxRAMFraction
MinRAMFraction
MonitorInUseLists
MustCallLoadClassInternal
NativeMonitorFlags
NativeMonitorSpinLimit
NativeMonitorTimeout
PermSize
PrintCompressedOopsMode
PrintGC
PrintGCDetails
PrintMalloc
PrintMallocFree
PrintSafepointStatistics
PrintSafepointStatisticsCount
PrintSafepointStatisticsTimeout
PrintSharedSpaces
SafepointSpinBeforeYield
SharedMiscCodeSize
SharedMiscDataSize
SharedReadOnlySize
SharedReadWriteSize
ShowSafepointMsgs
TraceBiasedLocking
TraceClassLoading
TraceClassLoadingPreorder
TraceClassPaths
TraceClassResolution
TraceClassUnloading
TraceExceptions
TraceJVMTIObjectTagging
TraceLoaderConstraints
TraceMonitorInflation
TraceRedefineClasses
TraceSafepointCleanupTime
TraceScavenge
UnlinkSymbolsALot
UnsyncloadClass
UseAppCDS
UseConcMarkSweepGC
UseLockedTracing
UseMembar
UseUTCFileTimestamp
VMThreadHintNoPreempt

UPDATE

Thanks to @chriswhocodes, VM Options Explorer now shows deprecated JVM flags.

Getting the parameters of a running JVM

You can use jps like:

jps -lvm

It prints something like:

4050 com.intellij.idea.Main -Xms128m -Xmx512m -XX:MaxPermSize=250m -ea -Xbootclasspath/a:../lib/boot.jar -Djb.restart.code=88
4667 sun.tools.jps.Jps -lvm -Dapplication.home=/opt/java/jdk1.6.0_22 -Xms8m

JVM Options List - still being maintained post Oracle?

Use java -XX:+PrintFlagsFinal to print available -XX options.
More diagnostic and experimental options can be added to list with following options:
-XX:+UnlockDiagnosticVMOptions
-XX:+UnlockExperimentalVMOptions (for Sun)
-XX:+UnlockInternalVMOptions (for JRockit)

NOTE: Current version of javac docs for Java 8 contains list of most -XX options: https://docs.oracle.com/javase/8/docs/technotes/tools/windows/java.html

Oracle's guide with 80+ options: http://www.oracle.com/technetwork/java/javase/tech/vmoptions-jsp-140102.html

Pierre Laporte's service with full search for 907 options (supports JDK 8):
http://jvm-options.tech.xebia.fr/

Stas's guide with 800+ options: http://stas-blogspot.blogspot.com/2011/07/most-complete-list-of-xx-options-for.html

Collection of options for 1.6.0 and older versions of JVM: http://www.xenoc.demon.co.uk/A%20Collection%20of%20JVM%20Options.htm



Related Topics



Leave a reply



Submit