How to kill a Java process on Windows without killing javaw.exe?

I have an external Windows.exe, which is actually a Java application. Running .exe launches javaw.exe, which in turn launches this Java application.

I did not write this application and did not have access to it through the API. However, I need to be able to kill him. So right now I'm just killing the Windows javaw.exe process, which is great for a test machine that runs only this Java application, but if I need finer granularity, I can't do it right now.

My search queries gave suggestions like the Sysinternal Process Explorer or the jps command in the JDK, but on the target systems for which I intend to provide a script, neither the JDK nor the Sysinternal Process Explorer can work.

Is there any other way that does not require an external tool? Is there a switch or command line parameter in javaw.exe that lists Java processes? Is there a jre version of jps?

Thank.

+5
source share
6 answers

I still suggest just killing javaw.exe.

I do not see a flaw, as this is the process that you want to kill in the end.

, , JVM. , , .

+3

JDK (, , JRE) jps, Java, , JVM. JMX/JConsole , "jps -ml" .

+3

JVM, javaw.exe. JVM Java , JVM , .

+2

javaw.exe, , .

, JConsole JVM. , , . , script , ( JMX , JConsole).

+1

javaw, , , , . , javaw. ?

0
source

Another approach: if you have jdk, the jvisualVM program is in the bin folder. It has good information about every running JVM context. One of the things you see is the PID of the virtual machine, which I use to kill the process in Windows using the task manager (it doesn’t appear on the Windows PID by default, but you can easily turn on the column by going into view mode → show columns)

0
source

All Articles