JPS of built-in JDK tools
Jps (Java Virtual Machine Process Status Tool) is a command provided by JDK to display the current pid of all java processes. It is simple and practical, it is very suitable for you to view some simple information about the current java Process on the linux/unix/windows platform.
Jps is used to display the ID of the current JAVA Process and view the detailed startup parameters of these processes through opt.
Jps is located in the bin directory of jdk.
1. JPS Command Format
Jps [options] [hostid]
2. Common Parameters
-Q: Only pid is displayed, and class name is not displayed. jar file name and parameters passed to main method are also displayed.
-M output parameters passed to the main method
-L output the complete package name of the main class of the application or the full path name of the jar file of the application
-V output parameters passed to JVM
The Hostid parameter is mainly used to enable the process status of the remote virtual machine that has enabled the RMI Service (this parameter is not available on the local server)
3. Source Code
Package com. jdkTools;
/**
* Simple application for testing JDK's built-in jps
* Parameter:-Xms30m-Xmx60m
* The parameter passed to the main parameter is: ffm
* @ Author fan fangming
*/
Public class EasyJPS {
Public staticvoid main (String [] args) throws Exception {
While (true ){
Thread. sleep (5000 );
System. out. println (args [0] + ", execute ...");
}
}
}
4. Running Parameters
* Parameter:-Xms30m-Xmx60m. this parameter is used to start a jvm vm.
* The parameter passed to the main parameter is: ffm
5. Running result
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
Jps 1628
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
Jps-m 7400
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 = 256 m-XX: ReservedCodeCacheSize = 64m-Dosgi.nls.warnings = ignore
7672 EasyJPS-Xms30m-Xmx60m-Dfile. encoding = GBK
Among them, 7672 EasyJPS ffm
And 7672 EasyJPS-Xms30m-Xmx60m-Dfile. encoding = GBK
It is the effect we can see through-m and-v, and the passed parameters are printed together, which can be used and processed in actual work.
-------------------------------------- Split line --------------------------------------
Install JDK and configure environment variables in Ubuntu
Install JDK 7 In Ubuntu (with Clojure download)
Install JDK 12.04 in Ubuntu
CentOS6.3 install JDK and environment Configuration
Ubuntu14.04 64-bit JDK1.7 Installation
This article permanently updates the link address: