jcmd
provides ‘VM.system_properties’ command,
it prints VM system properties.
For
example,
HelloWorld.java
public class HelloWorld { public static void main(String args[]) throws Exception { Thread t1 = new Thread() { public void run() { while (true) { try { Thread.sleep(1000); } catch (Exception e) { } } } }; t1.start(); } }
Compile
and run HelloWorld.java application.
Open
new terminal (or) command prompt and execute jcmd command.
C:\>jcmd 21744 HelloWorld 13220 19416 sun.tools.jcmd.JCmd
From
the jcmd output, I confirm that HelloWorld application is running with process
id 21744.
Execute
the command 'jcmd 21744 help' to get list of available commands associated with
process id 21744.
As
you see above image 'VM.system_properties' command is available for the process
id 21744.
Execute
the command 'jcmd 21744 VM.system_properties' to get all the system properties
used by this VM.
C:\>jcmd 21744 VM.system_properties 21744: #Fri Jul 27 08:55:35 IST 2018 java.runtime.name=Java(TM) SE Runtime Environment sun.boot.library.path=C\:\\Program Files\\Java\\jdk1.8.0_171\\jre\\bin java.vm.version=25.171-b11 java.vm.vendor=Oracle Corporation java.vendor.url=http\://java.oracle.com/ path.separator=; java.vm.name=Java HotSpot(TM) 64-Bit Server VM file.encoding.pkg=sun.io user.script= user.country=US sun.java.launcher=SUN_STANDARD sun.os.patch.level= java.vm.specification.name=Java Virtual Machine Specification user.dir=C\:\\Users\\krishna\\Documents\\Study\\Miscellaneous java.runtime.version=1.8.0_171-b11 java.awt.graphicsenv=sun.awt.Win32GraphicsEnvironment java.endorsed.dirs=C\:\\Program Files\\Java\\jdk1.8.0_171\\jre\\lib\\endorsed os.arch=amd64 java.io.tmpdir=C\:\\Users\\krishna\\TEMP\\ line.separator=\r\n java.vm.specification.vendor=Oracle Corporation user.variant= os.name=Windows 10 sun.jnu.encoding=Cp1252
No comments:
Post a Comment