2

This question might be a bit similar to this or this question.

How do I stop a particular .jar file from running in Mac OS? When I open up the activity monitor, it does not show the process listed. But I am sure it is running because when I visit the localhost (I have developed a .jar from a Spring Boot application), I can still see the welcome message!

Could you please let me know how I could stop a particular .jar file from executing? Thanks.

user207421
  • 305,947
  • 44
  • 307
  • 483
P.K.
  • 379
  • 1
  • 4
  • 16

2 Answers2

1

You can use jps to get the pid (and jar name), awk to parse the pid and then kill it. Like, (with bash or similar)

kill -9 $(jps | grep -i "thejar.jar" | awk '{print $1}')

or

kill -9 `jps | grep -i "thejar.jar" | awk '{print $1}'`

The -i option to grep makes it case insensitive. Omit if that is not needed.

Elliott Frisch
  • 198,278
  • 20
  • 158
  • 249
0

Step1: ps -aux | grep xxx, xxx is the name of .jar

Step2: kill -9 pid, pid you can get from the first command.

Tangoo
  • 1,329
  • 4
  • 14
  • 34