如何打印Java虚拟机的所有-XX参数

ton*_*ang 2 java jvm

如何在不参考规范的情况下在命令行上获取 -xx 支持的所有参数的列表?

java -X     
-Xmixed           mixed mode execution (default)
-Xint             interpreted mode execution only
-Xbootclasspath:<directories and zip/jar files separated by :>
                  set search path for bootstrap classes and resources
-Xbootclasspath/a:<directories and zip/jar files separated by :>
                  append to end of bootstrap class path
-Xbootclasspath/p:<directories and zip/jar files separated by :>
                  prepend in front of bootstrap class path
-Xdiag            show additional diagnostic messages
-Xnoclassgc       disable class garbage collection
-Xincgc           enable incremental garbage collection
-Xloggc:<file>    log GC status to a file with time stamps
-Xbatch           disable background compilation
-Xms<size>        set initial Java heap size
-Xmx<size>        set maximum Java heap size
-Xss<size>        set java thread stack size
-Xprof            output cpu profiling data
-Xfuture          enable strictest checks, anticipating future default
-Xrs              reduce use of OS signals by Java/VM (see documentation)
-Xcheck:jni       perform additional checks for JNI functions
-Xshare:off       do not attempt to use shared class data
-Xshare:auto      use shared class data if possible (default)
-Xshare:on        require using shared class data, otherwise fail.
-XshowSettings    show all settings and continue
-XshowSettings:all
                  show all settings and continue
-XshowSettings:vm
                  show all vm related settings and continue
-XshowSettings:system
                  (Linux Only) show host system or container
                  configuration and continue
-XshowSettings:properties
                  show all property settings and continue
-XshowSettings:locale
                  show all locale related settings and continue
Run Code Online (Sandbox Code Playgroud)

-X 选项是非标准选项,如有更改,恕不另行通知。

例如,可以通过-X来获取这些参数。

我如何获得-XX?有哪些可用参数?

小智 5

用这个。java -XX:+PrintFlagsFinal