How To stop an Executed Jar file

susparsy picture susparsy · Jun 18, 2013 · Viewed 77.7k times · Source

It feels like a dumb question to ask, but i cant seem to figure it out. when i run a *.jar file on windows it doesnt apears in the taskmanager processes. how can i terminate it , i have tried TASKKILL but it also doesnt work for me.

Answer

Yatendra Goel picture Yatendra Goel · Feb 12, 2014

On Linux

ps -ef | grep java

It will show u a list of processes out of which one will be your executable jar. Just kill that process by its process id.

sudo kill -9 <pid>

Is there any way to do this from the java code of the same jar file. Like killing itself once process completed.