How To stop an Executed Jar file
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.
Find the process id by jps
command & and kill them by taskkill
command.
Note that "-f
" is required with taskkill
or it may just send a termination signal not actually terminating it.
Did you try to kill the java.exe processes in the taskmanager? It should stop then.