Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Find name of .jar in java(w).exe process list

In my company environment, there's this script that runs on plenty computers and that I occasionally ask the users to kill because it's known to lock up from time to time.

I was thinking of a way to kill it myself. I've noticed I can remotely list using pslist and then killing it using pskill.

Now the problem is, when somebody's running multiple java applications (ex. Eclipse, this application, another java.exe app,...) it becomes tricky to kill the correct application in the pslist, that would look something like this:

javaw  4214 .. ...
javaw  5000 .. ...

And so on. These are different applications, but they all run from javaw.exe. Is there a way of finding out the name of the .jar they are running, so I can kill the process based on that?

like image 914
arnehehe Avatar asked Mar 04 '13 11:03

arnehehe


2 Answers

You can list java processes with

jps

or

jps -v

Jps is a tool provided with JDK and JRE, you'll find it in JDK_HOME/bin. Option -v shows additional info (JVM start parameters)

like image 180
Paweł Wyrwiński Avatar answered Oct 07 '22 14:10

Paweł Wyrwiński


You can use jps. It alone doesn't provide much helpful information to identify the java application. You need little bit extra details.

You can use the following options with jps to print the complete command line arguments passed to the java appliation (JVM arguments and main method arguments),

jps -lvm

Reference: https://docs.oracle.com/javase/8/docs/technotes/tools/unix/jps.html

like image 39
Manohar Avatar answered Oct 07 '22 13:10

Manohar