JPS(1)
π JPS(1) β the jps command, bestie! π«Ά
Okay so real talk: jps is your little bestie that lists out all the instrumented Java HotSpot VMs chillin' on your target system. Like a vibe check for your JVMs, y'know? π No cap, it's iconic.
Heads up bestie: This command is experimental and unsupported. It's giving "we're just vibing, don't @ us." π
β¨ SYNOPSIS β¨
jps [-q] [-mlvV] [hostid]
jps [-help]
π OPTIONS π
-qβ says "shhh π€«" to the class name, JAR file name, and the arguments passed to the main method. You just get a clean lil' list of only local JVM identifiers. Minimalist queen energy π.-mlvVβ you can mix and match any combination of these bad boys, fr fr:-mβ shows the arguments passed to the main method. Lowkey the output might be null for embedded JVMs, so don't come for it π.-lβ drops the full package name for the application's main class, or the full path name to the application's JAR file. Long form, main character energy π .-vβ displays the arguments passed to the JVM itself.-Vβ suppresses the class name, JAR file name, and main-method arguments β giving you only local JVM identifiers. Basically-q's twin sister π.
hostidβ the identifier of the host you want that process report from. It can include optional components telling you the communications protocol, port number, and other implementation-specific data. Peep the Host Identifier section below π.-helpβ pops up the help message for thejpscommand. Like a little "hey bestie, here's how this works" π«Ά.
π DESCRIPTION π
The jps command lists the instrumented Java HotSpot VMs on the target system. Simple as that. But bestie, it's limited β it only reports info on JVMs it actually has the access permissions for. Boundaries, y'know? β
If you run jps without specifying a hostid, it goes searching for instrumented JVMs on your local host. If you start it with a hostid, it searches for JVMs on the indicated host, using the specified protocol and port. And listen β a jstatd process is assumed to be running on that target host, so prep accordingly π§.
The command reports the local JVM identifier β the lvmid β for each instrumented JVM it finds on the target system. And the lvmid is typically, but not necessarily (iykyk), the operating system's process identifier for the JVM process. With no options, jps lists each Java application's lvmid followed by the short form of the application's class name or jar file name. That short form? It omits the class's package information or the JAR file's path information. Keeping it cute and concise β¨.
So here's the tea: jps uses the Java launcher to find the class name and arguments passed to the main method. But if the target JVM was started with a custom launcher, then the class or JAR file name and the arguments to the main method aren't available π. In that case, jps just outputs the string Unknown for the class name or JAR file name, and for the arguments to the main method. It said "idk her" π.
Also β the list of JVMs can be limited by the permissions granted to the principal running the command. It only lists the JVMs that principal has access rights to, as determined by operating-system-specific access control mechanisms. Permission check said no? Then you don't see it π«.
π HOST IDENTIFIER π
The host identifier β aka the hostid β is a string that indicates the target system. Its syntax corresponds to the syntax of a URI, and it goes a lil' something like this:
[protocol:][[//]hostname][:port][/servername]
Now let's break it down, bestie by bestie π:
protocolβ the communications protocol. If you omit it and don't specify a hostname, the default is a platform-specific, optimized, local protocol. If you omit it but you do specify a host name, the default protocol isrmi. Slay.hostnameβ a host name or IP address that indicates the target host. Omit thehostnameparameter and the target host is just your local host. Home sweet home π .portβ the default port for communicating with the remote server. Here's the fine print: if thehostnameparameter is omitted, or theprotocolparameter specifies an optimized, local protocol, then theportparameter is ignored π. Otherwise, treatment of theportparameter is implementation-specific. For the defaultrmiprotocol, theportparameter indicates the port number for thermiregistryon the remote host. And if you omit theportparameter while theprotocolparameter indicatesrmi, then the defaultrmiregistryport (1099) is used. Iconic default behavior, honestly β.servernameβ the treatment of this parameter depends on the implementation. For the optimized, local protocol, this field is ignored. For thermiprotocol, this parameter is a string representing the name of the RMI remote object on the remote host. Peep thejstatdcommand-noption for more π.
π¦ OUTPUT FORMAT OF THE JPS COMMAND π¦
The output of jps follows this pattern:
lvmid [ [ classname | JARfilename | "Unknown"] [ arg* ] [ jvmarg* ] ]
All output tokens are separated by white space. And here's a lil' caveat: an arg value that includes embedded white space introduces ambiguity when you're trying to map arguments to their actual positional parameters. Messy, but that's the vibe π¬.
Note, bestie: It's recommended that you don't write scripts to parse jps output, because the format might change in future releases. If you do write scripts that parse it, then expect to modify them for future releases of this tool. It's giving "don't get too attached" π. Plan accordingly, fr fr.
π EXAMPLES π
This section is giving "show, don't tell" β here are some examples of jps in the wild π§.
List the instrumented JVMs on the local host:
jps
18027 Java2Demo.JAR
18032 jps
18005 jstat
Next up: listing the instrumented JVMs on a remote host. This example assumes that the jstat server and either its internal RMI registry or a separate external rmiregistry process are running on the remote host on the default port (port 1099). It also assumes the local host has appropriate permissions to access the remote host. And it includes the -l option to output the long form of the class names or JAR file names. Long form, long hair, don't care π
:
jps -l remote.domain
3002 /opt/jdk1.7.0/demo/jfc/Java2D/Java2Demo.JAR
2857 sun.tools.jstatd.jstatd
And finally β listing the instrumented JVMs on a remote host with a nondefault port for the RMI registry. This example assumes that the jstatd server, with an internal RMI registry bound to port 2002, is running on the remote host. It also uses the -m option to include the arguments passed to the main method of each listed Java application. Look at all those args π₯:
jps -m remote.domain:2002
3002 /opt/jdk1.7.0/demo/jfc/Java2D/Java2Demo.JAR
3102 sun.tools.jstatd.jstatd -p 2002
And that's the whole vibe, bestie! β¨ This lil' masterpiece is from JDK 17, dated 2021, and it's the JPS(1) manual page β go forth and list those JVMs like the icon you are πππ¦
π¦ where this page comes from
- arch rolling: jdk17-openjdk 17.0.21.0.3.u1-1 Β· LicenseRef-Java
- Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms