days
0
-72
-2
hours
-1
-9
minutes
-5
-8
seconds
-3
0
search
For Linux and Windows

Quickly find your Java application process ID

Ram Lakshmanan
© Shutterstock / amenic181

For certain monitoring tools like yCrash, you need to pass your application process ID as input. In this article, Ram Lakshmanan will guide you through how to find your Java application process ID in both Linux/Unix and Windows operating systems – simply follow these steps.

In this post, we are going to discuss how to find your Java application process ID quickly. For certain monitoring tools like yCrash, you need to pass your application process ID as input. If you want to look for a more detailed post with several different options to find your application’s process ID, you can refer to this blog post.

SEE ALSO: “One of the greatest things about the Java ecosystem is the diversity of people and technology”

Finding Java application Process ID in Linux

On any Linux/Unix flavour of operating system issue the command:

ps -ef | grep java

The above command will display all the Java processes running on this machine and their arguments, process ID, and the user who launched it. When I issued the above command following was the output in my AWS EC2 Linux instance:

Fig: ‘PS’ command displaying all Java processes running on Linux machine

The red color highlight in the above figure indicates the process IDs of all Java processes running on this EC2 instance. From here, you can get hold of your application’s process ID.

Finding Java application Process ID in Windows

‘jps’ – Java Virtual Machine Process Status Tool is packaged in JDK. This tool will display all the Java processes that are running on that machine. Below are the steps to invoke the ‘jps’ command.

  1. open command prompt.
  2. cd to ‘bin’ folder, where JDK is installed
  3. Issue ‘jps’ command

Example:

cd C:\Program Files\Java\jdk1.8.0_181\bin

jps

When above command was issued, following was the output:

Fig: ‘jps’ command displaying all Java processes running on the Windows machine

Red color highlight in the above figure indicates the process IDs of all Java processes running on this windows instance. From here, you can get hold of your application’s process ID. Note in my windows machine, I have 3 java processes running:

  1. Jps – JVM process status tool that I launched just now
  2. Bootstrap – Tomcat server process
  3. org.eclipse.equinox.launcher_1.3.100.v20150511-1540.jar – Eclipse IDE

Note: Unlike ‘ps’ command in Linux (example given above), you will not see all the Java process arguments. One shortcoming in this approach is ‘jps’ will show only the java process’s first command. You can see all the java process arguments, only when the ‘ps’ command is issued.

Author
Ram Lakshmanan
Every single day, millions & millions of people in North America—bank, travel, and commerce—use the applications that Ram Lakshmanan has architected. Ram is an acclaimed speaker in major conferences on scalability, availability, and performance topics. Recently, he has founded a startup, which specializes in troubleshooting performance problems.

guest
0 Comments
Inline Feedbacks
View all comments