JPS Command (Java Virtual machine Process Status Tool)

Source: Internet
Author: User

1. Introduction

Used to view the specific state of all Java processes that have access to the hotspot-based JVM, including the process ID, the path of the process startup, and the startup parameters, similar to the PS on Unix, except that JPS is used to display the Java process, and that JPS can be understood as a subset of PS.

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 Java process above the specified HostID, but this requires a 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.

-j is used to pass the JVM option to the Java loader called by Javac, for example, "-j-xms48m" sets the boot memory to 48M, and the-J option makes it easy to pass parameters to the underlying virtual machine application based on Java 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, and 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)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.