I am a newbie in cmd, so please allow me to ask a stupid question: How can we stop a running Java process through Windows cmd?
For example, if we start Jetty (a mini web server) with the following command:
start javaw -jar start.jar
How do we find the process and stop it later?
Obviously the following command does not work:
stop javaw -jar start.jar
If you want to kill all java.exe processes : taskkill /F /IM java.exe /T .
pgrep -a java will return the PID and full command line of each java process. Once you have the PID of the command you wish to kill, use kill with the -9 (SIGKILL) flag and the PID of the java process you wish to kill.
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.
Here's a quick one: 1) Open Notepad. 2) Paste the line taskkill /f /im java.exe to Notepad. 3) Save the file as "kill-java. cmd" .
When I ran taskkill to stop the javaw.exe process it would say it had terminated but remained running. The jqs process (java qucikstart) needs to be stopped also. Running this batch file took care of the issue.
taskkill /f /im jqs.exe taskkill /f /im javaw.exe taskkill /f /im java.exe
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