Thursday 16 August 2018

jcmd: VM.version: Print jvm version information

jcmd command provides ‘VM.version’ command to print the vm version information.

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 another command prompt (or) terminal and execute jcmd command.
C:\>jcmd
20896 sun.tools.jcmd.JCmd
13220
17260 HelloWorld


Execute the command 'jcmd 17260 help' to get the list of available commands with the process id 17260.


As you see above image ‘VM.version’ command is available with the process 17260.

Execute the command 'jcmd 17260 VM.version' to know the virtual machine details of the process id 17260.




Previous                                                 Next                                                 Home

No comments:

Post a Comment