user2675649
user2675649

Reputation: 107

Check processes that are running - java

I want to write a java application that is to be deployed on a unix box. I need to check the running processes - that are running on the box. Could someone show me an example / point me in the right direction?

Upvotes: 7

Views: 47446

Answers (2)

Clauds
Clauds

Reputation: 950

I came across some alternatives for ps aux | grep java provided by Java that need less typing:

jcmd

and

jps -v

The option -v will show the arguments passed to the JVM.

If you get process information unavailable this could be because the process is running with OpenJDK. If you are root and the process was started with a non-root user you can use the following to see the details (replace <user> with the username):

sudo -u <user> jps -v

Another nice feature of jcmd is that you can display the Java version that a specific process uses (in case ps aux | grep java does not show it), that's how I came across the two (replace <pid> with the process id):

jcmd <pid> VM.version

Upvotes: 3

ktm5124
ktm5124

Reputation: 12123

If you want to find the running java processes, you can use

ps -ef | grep java

If you need to check which ports are in use,

netstat -tupln

Upvotes: 20

Related Questions