Listing running Java processes

This post explores jps command line utility provided by JDK

Posted by Vipin Sharma on Friday, May 28, 2021 Tags: OpenJDK tools   5 minute read

This is a draft post, work in progress:

Listing Java processes

ps -ef is one of the most used Linux commands for Java developers. JDK provides similar functionality for Java processes through jps. The jps command-line utility provides a list of all running Java processes on a machine for which the user has access rights. This is determined by access-control mechanisms specific to the operating system. jps utility can also provide information on arguments passed to the main method, arguments passed to JVM, etc. In this post, we will see all the functionalities provided by jps.

Troubleshooting a Java Application with jps

In this section, we will see how to use jps with a running Java process.

jps command

jps [options] pid

options:    This represents the jps command-line options.
pid:        The process ID for which the information specified by the options is to be printed.

Java program we will be debugging in this post

Following is the sample class we are going to debug and try to understand different features available.

public class Test
   public static void main(String[] args)

For all our examples we will be using Java 17, as of writing this post it is built using JDK master branch. This post explains how to build JDK from the source.

java -version
openjdk version "17-internal" 2021-09-14
OpenJDK Runtime Environment (build 17-internal+0-adhoc.vipin.jdk)
OpenJDK 64-Bit Server VM (build 17-internal+0-adhoc.vipin.jdk, mixed mode)

Running Java process using following command, this will be used to show output in rest of the blog post.

java -XX:ConcGCThreads=6 -Xmx256m -Xms8m -Xss256k Test argument1 argument2

Following command shows process ids, which are JVM identifiers.

jps -q



Command to list Java processes with main class names, this is the same output we get using command jps -V as well



10694 Jps
7067 Main
7470 Launcher
10366 Test

jps -l displays the full package name for the application’s main class or the full pathname to the application’s JAR file.


jps -l


10554 jdk.jcmd/
7067 com.intellij.idea.Main
7470 org.jetbrains.jps.cmdline.Launcher
10366 Test

jps -m displays the arguments passed to the main method

jps -m


10726 Jps -m
7067 Main
7470 Launcher /home/vipin/.local/share/JetBrains/Toolbox/apps/IDEA-C/ch-0/203.7148.57/lib/commons-lang3-3.10.jar:/home/vipin/.local/share/JetBrains/Toolbox/apps/IDEA-C/ch-0/203.7148.57/lib/httpclient-4.5.12.jar:/home/vipin/.local/share/JetBrains/Toolbox/apps/IDEA-C/ch-0/203.7148.57/lib/annotations.jar:/home/vipin/.local/share/JetBrains/Toolbox/apps/IDEA-C/ch-0/203.7148.57/lib/netty-buffer-4.1.52.Final.jar:/home/vipin/.local/share/JetBrains/Toolbox/apps/IDEA-C/ch-0/203.7148.57/plugins/java/lib/jps-javac-extension-1.jar:/home/vipin/.local/share/JetBrains/Toolbox/apps/IDEA-C/ch-0/203.7148.57/lib/jdom.jar:/home/vipin/.local/share/JetBrains/Toolbox/apps/IDEA-C/ch-0/203.7148.57/lib/netty-resolver-4.1.52.Final.jar:/home/vipin/.local/share/JetBrains/Toolbox/apps/IDEA-C/ch-0/203.7148.57/lib/maven-resolver-api-1.3.3.jar:/home/vipin/.local/share/JetBrains/Toolbox/apps/IDEA-C/ch-0/203.7148.57/plugins/java/lib/maven-resolver-connector-basic-1.3.3.jar:/home/vipin/.local/share/JetBrains/Toolbox/apps/IDE
10366 Test argument1 argument2

jps -v displays the arguments passed to the JVM.

jps -v


2468  -Djava.library.path=/tmp/.mount_jetbraH5N0hQ -Xmx256m -Xms8m -Xss256k -XX:+UseStringDeduplication -XX:+UseCompressedOops -XX:+UseSerialGC -Djava.awt.headless=true -Djdk.lang.processReaperUseDefaultStackSize=true vfprintf exit abort -DTOOLBOX_VERSION=1.20.7940
10501 Jps -Dapplication.home=/home/vipin/githubprojects/jdk/build/linux-x86_64-server-release/jdk -Xms8m -Djdk.module.main=jdk.jcmd
7067 Main -Xms128m -Xmx2048m -XX:ReservedCodeCacheSize=512m -XX:+UseConcMarkSweepGC -XX:SoftRefLRUPolicyMSPerMB=50 -XX:CICompilerCount=2 -XX:+HeapDumpOnOutOfMemoryError -XX:-OmitStackTraceInFastThrow -ea -Djdk.http.auth.tunneling.disabledSchemes="" -Djdk.attach.allowAttachSelf=true -Djdk.module.illegalAccess.silent=true -Dkotlinx.coroutines.debug=off -XX:ErrorFile=/home/vipin/java_error_in_idea_%p.log -XX:HeapDumpPath=/home/vipin/java_error_in_idea_.hprof -Didea.paths.selector=IdeaIC2020.3 -Djb.vmOptionsFile=/home/vipin/.local/share/JetBrains/Toolbox/apps/IDEA-C/ch-0/203.7148.57.vmoptions -Didea.platform.prefix=Idea -Didea.jre.check=true
7470 Launcher -Xmx700m -Djava.awt.headless=true -Djdt.compiler.useSingleThread=true -Dpreload.project.path=/home/vipin/githubprojects/jdk -Dpreload.config.path=/home/vipin/.config/JetBrains/IdeaIC2020.3/options -Dcompile.parallel=false -Drebuild.on.dependency.change=true -Dio.netty.initialSeedUniquifier=4046065713679813272 -Dfile.encoding=UTF-8 -Duser.language=en -Didea.paths.selector=IdeaIC2020.3 -Didea.home.path=/home/vipin/.local/share/JetBrains/Toolbox/apps/IDEA-C/ch-0/203.7148.57 -Didea.config.path=/home/vipin/.config/JetBrains/IdeaIC2020.3 -Didea.plugins.path=/home/vipin/.local/share/JetBrains/IdeaIC2020.3 -Djps.log.dir=/home/vipin/.cache/JetBrains/IdeaIC2020.3/log/build-log -Djps.fallback.jdk.home=/home/vipin/.local/share/JetBrains/Toolbox/apps/IDEA-C/ch-0/203.7148.57/jbr -Djps.fallback.jdk.version= -Dio.netty.noUnsafe=true -Djps.backward.ref.index.builder=true -Dkotlin.incremental.compilation=true
10366 Test -XX:ConcGCThreads=6 -Xmx256m -Xms8m -Xss256k

jcmd to list Java processes

jcmd or jcmd -l both provides similar information as jps -l. You can read more about jcmd on post.


Utilities like this are very useful in a situation when we need to analyze and resolve problems in production Java application quickly. jps is an amazing utility part of JDK itself, no need to install any third party software.

If you want to get amazing Java jobs, I wrote an ebook 5 steps to Best Java Jobs. You can download this step-by-step guide for free!


  1. Javadoc