Reputation: 67
I have a runnable jar which won't shutdown. i have executed it in my windows machine by double clicking on it. How can i terminate that application.
I dont what to kill all java.exe processes as i want other apps to run
Upvotes: 1
Views: 16111
Reputation: 750
There are three options:
java -jar [YourJarPath]
(Close by (Ctr + C) or close your commandlineThen look for "javaw.exe". Right Click and then something like Shutdown or exit Task.
To find the jar name, start in cmd (commandline) this code:
C:\Program Files\Java\[YOUR JAVA VERSION]\bin\jps.exe
it will return something like this:
The number befor the "name" is your PID
that is also listed in the taskmanager right next to javaw.exe
Upvotes: 7
Reputation: 919
jps -v
Will list all running jars along with their PID. Then you can just kill that process (with kill $PID
)
Upvotes: 4
Reputation: 34900
JVM starts new java.exe
process each time you run jar
. Obviously because jar starting is performed as java -jar <jar_name>
.
So by locating exact process which holds your jar's process you can safely kill without worrying about rest java apps.
Upvotes: 1