Use of jps jmap

 

first part:

 Source:

 1 public class ObjectText {
 2     int a=0;
 3     public static void main(String[] args) {
 4         ObjectText ot = new ObjectText();
 5 
 6         try {
 7             Thread.sleep(100000);
 8         } catch (InterruptedException e) {
 9 
10         }
11     }
12 }

 

1.  JPS (the JDK provides a small tool to view the current Java process)

         全名:Java Virtual Machine Process Status Tool

           Role: View the current process situation java process running number system

       

  2. jmap: Output JVM information object heap

     

 

 

    3.  jmap  -histo [:live]  pid  >  log.txt   :  

       Print the number of instances of various types of heap, reverse row and lead into the file. Plus live parameter print only the objects alive.

    

 

 

 

   4. start:. View print log.txt file

  

 

 

 

 

  

 the second part:

   1. javac: compiling a source file as a java byte code class files "java language compiler"

           Such as: javac HelloWorld.java

           After running Javac command, if successful compilation no errors, file a HelloWorld.class will appear.

  2.java: run class bytecode files

           Such as: java HelloWorld

           Note: Do not add .class after the java command

 

Note: When using the above two commands you need to find java code stored in the folder, and then type "cmd" on top "Search" bar

Just press Enter. Pop-up "Command Prompt", we can see the path on our "Command Prompt" and store the path of the same java code.

 

3. javap -c * .class -> JVM assembly instructions

 

 

 

 

Guess you like

Origin www.cnblogs.com/ljl150/p/11690787.html