|
Jps (Java Virtual Machine Process Status Tool) is a JDK supplied all current java process pid command display, simple and practical for the linux / unix / windows platform simply see the current situation some simple java process.
jps its role is to display the id number of the current process of JAVA, can start to view detailed parameters of these processes through opt.
jps located under jdk bin directory.
1, JPS command format
jps [options] [hostid]
2, commonly used parameters
-q Displays pid and no show class name, jar file name and arguments passed to the main method
-m output parameters passed to the main method
jar file full path name -l output of the application main class or the full name of the application package
-v JVM arguments passed to the output
Hostid parameter is mainly used to open up the process status of RMI remote virtual machine services (to the server machine can not use this parameter)
3, the source code
package com.jdkTools;
/ **
* Simple application for the use of the test comes with the JDK jps
* Parameters: -Xms30m -Xmx60m
* Parameter is passed to the main parameters: ffm
* /
public class EasyJPS {
public staticvoid main (String [] args) throws Exception {
while (true) {
Thread.sleep (5000);
System.out.println (args [0] + ", in the implementation of ...");
}
}
}
4, the operating parameters
* Parameters: -Xms30m -Xmx60m, this parameter is used to start the JVM virtual machine
* Parameter is passed to the main parameters: ffm
5, the results
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. all rights reserved.
C: \ Users \ fan> cd C: \ Program Files \ Java \ jdk1.6.0_25 \ bin
C: \ Program Files \ Java \ jdk1.6.0_25 \ bin> jps
1628 Jps
2856
7672 EasyJPS
C: \ Program Files \ Java \ jdk1.6.0_25 \ bin> jps -q
4432
2856
7672
C: \ Program Files \ Java \ jdk1.6.0_25 \ bin> jps -m
2856
7672 EasyJPS ffm
7400 Jps -m
C: \ Program Files \ Java \ jdk1.6.0_25 \ bin> jps -l
7944 sun.tools.jps.Jps
2856
7672 com.jdkTools.EasyJPS
C: \ Program Files \ Java \ jdk1.6.0_25 \ bin> jps -v
2856 -Xms256m-Xmx768m -XX: MaxPermSize = 256m -XX: ReservedCodeCacheSize = 64m-Dosgi.nls.warnings = ignore
7672 EasyJPS -Xms30m -Xmx60m -Dfile.encoding = GBK
Wherein, 7672 EasyJPS ffm
And 7672 EasyJPS -Xms30m -Xmx60m -Dfile.encoding = GBK
We use -m and -v to see the effect of the incoming parameters also printed out together, and can be used in the actual work process. |
|
|
|