JVM command line monitoring tool jps

Introduction to jps

Use jps to view the running Java process ID. The Java process ID queried by jps is consistent with the process ID of the operating system.

Parameter explanation

content illustrate
-q Only display LVMID (local virtual machine id), that is, the unique id of the local virtual machine, not the name of the main class
-l Output the full class name of the main class, if the jar package is executed, output the full name of the jar package
-m Output parameters passed to main() when the virtual machine process is started
-v List the JVM parameters when the virtual machine process is started

Example of use

1) Print the full class name: jps -l

insert image description here
insert image description here

2) Print the parameters passed to main(): jps -m

insert image description here

public class ParamTest {
    
    
    public static void main(String[] args) throws InterruptedException {
    
    
        if(args.length>0) {
    
    
            System.out.println(Arrays.toString(args));
        } else {
    
    
            System.out.println("no args");
        }
        Thread.sleep(5000000);
    }
}

insert image description here
insert image description here

3) Print the JVM parameters when the virtual machine process starts: jps -v

insert image description here
insert image description here

Precautions

If the -XX:-UsePerfData parameter is added when the JVM is started, jps cannot monitor it.
insert image description here
insert image description here

java -XX:-UsePerfData -Xmx8m -jar ParamTest.jar hello

Guess you like

Origin blog.csdn.net/fengsheng5210/article/details/123657082