Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How To stop an Executed Jar file

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.

like image 540
susparsy Avatar asked Jun 18 '13 09:06

susparsy


People also ask

How do I kill a jar in Windows?

If you want to kill all java.exe processes : taskkill /F /IM java.exe /T .

How do I stop a java program from running?

In Java exit() method is in java. This System. exit() method terminates the current JVM running on the system which results in termination of code being executed currently.


1 Answers

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.

like image 199
Yatendra Avatar answered Oct 05 '22 14:10

Yatendra