user3629658
user3629658

Reputation: 67

Java: How to stop a Executable jar which never terminates

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

Answers (3)

Developer66
Developer66

Reputation: 750

There are three options:

  • Start in commandline with java -jar [YourJarPath] (Close by (Ctr + C) or close your commandline
  • Restart your Windows
  • Terminate it per TaskManager (Ctr+Alt+Del)

Under "Details" TaskManager Taskbar

Then look for "javaw.exe". Right Click and then something like Shutdown or exit Task. enter image description here

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: Img

The number befor the "name" is your PID that is also listed in the taskmanager right next to javaw.exe

Upvotes: 7

JonLuca
JonLuca

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

Andremoniy
Andremoniy

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

Related Questions