When a java based application starts to misbehave on a windows machine, you want to be able to kill the process in the task manager if you can't quit the application normally. Most of the time, there's more than one java based application running on my machine. Is there a better way than just randomly killing java.exe processes in hope that you'll hit the correct application eventually?
EDIT: Thank you to all the people who pointed me to Sysinternal's Process Explorer - Exactly what I'm looking for!
start "MyProgramName" java java-program.. Here start command will open a new window and run the java program with window's title set to MyProgramName. Your Java program will be killed only.
Using taskkill, you can kill a process based on window title using a filter. If the window title has quotes in it, you can escape the nested quotes with a backslash ( \ ). You can use tasklist in a similar manner to search for a task based on its window title.
Scroll down to the "Java.exe" process. Right-click the process name and select "End Task." Click "Yes" to confirm that you want to stop the process. The process stops, and any opened Java programs also stop.
Run jps -lv
which shows PIDs and command lines of all running Java processes.
Determine PID of the task you want to kill. Then use command:
taskkill /PID <pid>
to kill the misbehaving process.
Download Sysinternal's Process Explorer. It's a task manager much more powerfull than Windows's own manager.
One of it's features is that you can see all the resources that each process is using (like registry keys, hard disk directories, named pipes, etc). So, browsing the resources that each java.exe process holds might help you determine wich one you want to kill. I usually find out by looking for the one that's using a certain log file directory.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With