I am adding this new answer because, according to the JDK8 documentation, jcmd is now proposed.
It is recommended that you use the latest jcmd utility instead of the previous jstack, jinfo, and jmap utilities for advanced diagnostics and reduced performance.
Below are the commands to get the desired properties / flags.
jcmd pid VM.system_properties jcmd pid VM.flags
We need a pid, for this use jcmd -l as shown below
username@users-Air:~/javacode$ jcmd -l 11441 Test 6294 Test 29197 jdk.jcmd/sun.tools.jcmd.JCmd -l
Now it's time to use these pids to get the properties / flags you need
Command: jcmd 11441 VM.system_properties
11441: #Tue Oct 17 12:44:50 IST 2017 gopherProxySet=false awt.toolkit=sun.lwawt.macosx.LWCToolkit file.encoding.pkg=sun.io java.specification.version=9 sun.cpu.isalist= sun.jnu.encoding=UTF-8 java.class.path=. java.vm.vendor=Oracle Corporation sun.arch.data.model=64 java.vendor.url=http\:
Command: jcmd 11441 Output from VM.flags:
11441: -XX:CICompilerCount=3 -XX:ConcGCThreads=1 -XX:G1ConcRefinementThreads=4 -XX:G1HeapRegionSize=1048576 -XX:InitialHeapSize=67108864 -XX:MarkStackSize=4194304 -XX:MaxHeapSize=1073741824 -XX:MaxNewSize=643825664 -XX:MinHeapDeltaBytes=1048576 -XX:NonNMethodCodeHeapSize=5830092 -XX:NonProfiledCodeHeapSize=122914074 -XX:ProfiledCodeHeapSize=122914074 -XX:ReservedCodeCacheSize=251658240 -XX:+SegmentedCodeCache -XX:-UseAOT -XX:+UseCompressedClassPointers -XX:+UseCompressedOops -XX:+UseFastUnorderedTimeStamps -XX:+UseG1GC
For more instructions on using jcmd, see my blog.
Vipin Oct 17 '17 at 7:22 2017-10-17 07:22
source share