In this article we are going to see the jps commands.
What is jps?
Java/JVM Process status (jps) is a tool to instrument Java Process on a target system. The jps reports the local VM (or lvmid, typically, but always, system’s process identifier). If no option, jps lists each Java application’s lvmid followed by the short form of the application’s class name or jar file name.
jps shows string Unknown for the class name /JAR name and for arguments to the main method when custom launcher. jps command may be limited by the permissions
Syntax
jps [options] [hostid]
In here, hostid is a host identifier for which the process report will be generated.
The jps lists the instrumented JVM and reports(permitted info).
- If no hostid, it looks JVMs at localhost.
- If started with a hostid, it looks JVMs on the specific host(with a protocol and port). A jstatd process is assumed to be running on the target host.
jps options :
- q : Shows list of local VM identifiers(Suppress class name/JAR name/Main method arguments)
- m : Output the Main Method arguments
- l : Shows full package name for main class or full path of JAR file.
- v : Shows arguments passed to the JVM.
- V : Shows arguments passed to the JVM through the flags file (.hotspotrc or by the -XX:Flags=filename).
- J(option) : Pass option to the java launcher.
Notes:
-
The hostid is same as VMI(see in below of jstat tool)
[protocol:][[//]hostname][:port][/servername]
-
jps provides output in following format
lvmid [ [ classname | JARfilename | "Unknown"] [ arg* ] [ jvmarg* ] ]