1. Introduction
Used to view based onHotSpotOf inside, all java, idunixps jps java jps ps < span>
when using JPS , if no hostid is specified , it will only display all Java processes in the local environment, and if HostID is specified, it will display the specified HostID above the Java process, but this requires the JSTATD service on the remote service , you can see the previous jstatd section to start the Jstad service.
2. command Format
JPS [Options] [HostID]
3. Common parameter Description
-Q ignores the output's class name,Jar name, and parameters passed to The main method, only outputs the PID.
The-M output is passed to The main method parameter, and if it is an inline JVM, the output is null.
-L Output the full package name of the application main class, or the full path to the application JAR file.
-V Output passed to the JVM parameters.
-V outputs the parameters (. hotspotrc files, or files specified by parameter -xx:flags=<filename> ) passed to the JVM by the tagged file.
The-j is used to pass the JVM option to the Java loader called by Javac , for example, "-j-xms48m" will set the boot memory to 48M, using - The J option makes it very easy to pass parameters to the underlying virtual machine application for Java-based development.
4. Server Identification
HostID Specifies the target server, which has the following syntax:
[Protocol:] [[//]hostname] [:p ORT] [/ServerName]
Protocol- if protocol and hostname are not specified, that represents the local protocol associated with the current environment, if hostname is specified and no protocol is specified , then the default for protocol is RMI.
Hostname-The IP or name of the server , not specified, indicates the native.
Port- The ports of the remote RMI , which defaults to 1099 if not specified .
Servername- name of the JSTATD registered in the RMI registry .
5. Examples of Use
5.1, List the local Java process
Without any parameters
|
[Email protected]:~$ JPS
11644 Main
1947
12843 Jps |
With- v parameter
|
[Email protected]:~$ jps-v
11644 MAIN-AGENTLIB:JDWP=TRANSPORT=DT_SOCKET,SUSPEND=Y,ADDRESS=LOCALHOST:43467-DFILE.ENCODING=GBK
1947-dosgi.requiredjavaversion=1.5-xx:maxpermsize=256m-xms40m-xmx512m
12858 jps-denv.class.path=/home/fenglibin/java6/lib/dt.jar:/home/fenglibin/java6/lib/tools.jar::/usr/bin/ Libtool:/usr/bin/autoconf:/usr/local/berkeleydb.4.8/lib-dapplication.home=/home/fenglibin/java6-xms8m |
With- l parameter
|
[Email protected]:~$ jps-l
11644 Com.alibaba.china.webww.core.Main
12870 Sun.tools.jps.Jps
1947
|
5.2, List remote Java processes
In the jstatd Chapter, we have passed:
|
Rmiregistry 2020&jstatd-j-djava.security.policy=all.policy-p 2020-n Alternatejstatdservername |
The jstatd service named Alternatejstatdservername is started , and we can now list the Java processes to which it has access by using the service .
[Email protected]:~$ JPS 10.1.1.234:2020/alternatejstatdservername
29556 Bootstrap
28671 Wsprelauncher
2602 Registryimpl
18272 Test
2603 JSTATD
JPS Command (Java Virtual machine Process Status Tool)