1JPS(1) JDK Commands JPS(1)
2
3
4
6 jps - list the instrumented JVMs on the target system
7
9 Note: This command is experimental and unsupported.
10
11 jps [-q] [-mlvV] [hostid]
12
13 jps [-help]
14
16 -q Suppresses the output of the class name, JAR file name, and ar‐
17 guments passed to the main method, producing a list of only lo‐
18 cal JVM identifiers.
19
20 -mlvV You can specify any combination of these options.
21
22 · -m displays the arguments passed to the main method. The out‐
23 put may be null for embedded JVMs.
24
25 · -l displays the full package name for the application's main
26 class or the full path name to the application's JAR file.
27
28 · -v displays the arguments passed to the JVM.
29
30 · -V suppresses the output of the class name, JAR file name, and
31 arguments passed to the main method, producing a list of only
32 local JVM identifiers.
33
34 hostid The identifier of the host for which the process report should
35 be generated. The hostid can include optional components that
36 indicate the communications protocol, port number, and other im‐
37 plementation specific data. See Host Identifier.
38
39 -help Displays the help message for the jps command.
40
42 The jps command lists the instrumented Java HotSpot VMs on the target
43 system. The command is limited to reporting information on JVMs for
44 which it has the access permissions.
45
46 Note:
47
48 JDK 10 added support for using the Attach API when attaching to Java
49 processes running in a separate docker process. However, the jps tool
50 cannot see JVM processes running in a separate docker instance. If you
51 are trying to connect a Linux host with a Virtual Machine within a
52 docker container, you must use tools such as ps to look up the PID of
53 the JVM and then specify the PID on the command line of the tools that
54 accept the PID.
55
56 If the jps command is run without specifying a hostid, then it searches
57 for instrumented JVMs on the local host. If started with a hostid,
58 then it searches for JVMs on the indicated host, using the specified
59 protocol and port. A jstatd process is assumed to be running on the
60 target host.
61
62 The jps command reports the local JVM identifier, or lvmid, for each
63 instrumented JVM found on the target system. The lvmid is typically,
64 but not necessarily, the operating system's process identifier for the
65 JVM process. With no options, the jps command lists each Java applica‐
66 tion's lvmid followed by the short form of the application's class name
67 or jar file name. The short form of the class name or JAR file name
68 omits the class's package information or the JAR files path informa‐
69 tion.
70
71 The jps command uses the Java launcher to find the class name and argu‐
72 ments passed to the main method. If the target JVM is started with a
73 custom launcher, then the class or JAR file name, and the arguments to
74 the main method aren't available. In this case, the jps command out‐
75 puts the string Unknown for the class name, or JAR file name, and for
76 the arguments to the main method.
77
78 The list of JVMs produced by the jps command can be limited by the per‐
79 missions granted to the principal running the command. The command
80 lists only the JVMs for which the principal has access rights as deter‐
81 mined by operating system-specific access control mechanisms.
82
84 The host identifier, or hostid, is a string that indicates the target
85 system. The syntax of the hostid string corresponds to the syntax of a
86 URI:
87
88 [protocol:][[//]hostname][:port][/servername]
89
90 protocol
91 The communications protocol. If the protocol is omitted and a
92 hostname isn't specified, then the default protocol is a plat‐
93 form-specific, optimized, local protocol. If the protocol is
94 omitted and a host name is specified, then the default protocol
95 is rmi.
96
97 hostname
98 A host name or IP address that indicates the target host. If
99 you omit the hostname parameter, then the target host is the lo‐
100 cal host.
101
102 port The default port for communicating with the remote server. If
103 the hostname parameter is omitted or the protocol parameter
104 specifies an optimized, local protocol, then the port parameter
105 is ignored. Otherwise, treatment of the port parameter is im‐
106 plementation-specific. For the default rmi protocol, the port
107 parameter indicates the port number for the rmiregistry on the
108 remote host. If the port parameter is omitted, and the protocol
109 parameter indicates rmi, then the default rmiregistry port
110 (1099) is used.
111
112 servername
113 The treatment of this parameter depends on the implementation.
114 For the optimized, local protocol, this field is ignored. For
115 the rmi protocol, this parameter is a string that represents the
116 name of the RMI remote object on the remote host. See the js‐
117 tatd command -n option.
118
120 The output of the jps command has the following pattern:
121
122 lvmid [ [ classname | JARfilename | "Unknown"] [ arg* ] [ jv‐
123 marg* ] ]
124
125 All output tokens are separated by white space. An arg value that in‐
126 cludes embedded white space introduces ambiguity when attempting to map
127 arguments to their actual positional parameters.
128
129 Note:
130
131 It's recommended that you don't write scripts to parse jps output be‐
132 cause the format might change in future releases. If you write scripts
133 that parse jps output, then expect to modify them for future releases
134 of this tool.
135
137 This section provides examples of the jps command.
138
139 List the instrumented JVMs on the local host:
140
141 jps
142 18027 Java2Demo.JAR
143 18032 jps
144 18005 jstat
145
146 The following example lists the instrumented JVMs on a remote host.
147 This example assumes that the jstat server and either the its internal
148 RMI registry or a separate external rmiregistry process are running on
149 the remote host on the default port (port 1099). It also assumes that
150 the local host has appropriate permissions to access the remote host.
151 This example includes the -l option to output the long form of the
152 class names or JAR file names.
153
154 jps -l remote.domain
155 3002 /opt/jdk1.7.0/demo/jfc/Java2D/Java2Demo.JAR
156 2857 sun.tools.jstatd.jstatd
157
158 The following example lists the instrumented JVMs on a remote host with
159 a nondefault port for the RMI registry. This example assumes that the
160 jstatd server, with an internal RMI registry bound to port 2002, is
161 running on the remote host. This example also uses the -m option to
162 include the arguments passed to the main method of each of the listed
163 Java applications.
164
165 jps -m remote.domain:2002
166 3002 /opt/jdk1.7.0/demo/jfc/Java2D/Java2Demo.JAR
167 3102 sun.tools.jstatd.jstatd -p 2002
168
169
170
171JDK 14 2020 JPS(1)