How to find and kill all Java Processes to avoid an OS reboot if Java will be installed silently?
How to kill process depends on what OS you use. But to find Java processes you can use jcmd -l
command. This command list all java processes on local your machine.
Related videos on Youtube
Comments
-
030 over 1 year
Introduction
In order to avoid a reboot or occurrence of a pop-up which requests to reboot the OS if a newer version of Java will be installed silently, all processes which are using Java have to be killed.
Just killing java.exe by executing the following command:
taskkill /im java.exe /f
does not solve the issue as some processes will continue to use java, e.g. postgresql JDBC, webbrowsers, tomcat, eclipse.
If all processes which are using Java are killed before Java will be installed silently, the OS will not be rebooted.
The approach to kill processes individually which are using java is not a persistent solution as if another program will be installed in the future which will use java and not be killed, the system will be rebooted again if java will be installed silently.
Question
How to find all processes which are using java and kill them all to avoid OS will be rebooted or a pop up will occur which requests to reboot the system if Java will be installed silently?
-
barlop almost 10 yearsOne way would be to get a list of all processes (running processes), and decipher whether they are java based, then kill the java based ones. So you need a command that determines if a process is java based. I am blessed in not having any java programs to test, but maybe this gnuwin32.sourceforge.net/packages/file.htm will show whether a process is java based. otherwise you need some other method.
-
030 almost 10 yearsThe program has been installed.
file --help
has been executed and a number of commands appears. Which of these should be used in order to determine which processes are using Java?file /path/to/java
results inC:\Program Files\Java\jdk1.8.0_05\bin\java.exe; PE32+ executable for MS Windows (console) Mono/.Net assembly
. -
barlop almost 10 yearsThat means java,exe is not written in java. And that makes sense that java.exe wouldn't be written in java.
-
030 almost 10 yearsThe same result for
Apache Directory Studio
(C:\Program Files\Apache Directory Studio\Apache Directory Studio.exe; PE32+ executable for MS Windows (GUI) Mono/.Net assembly) andTomcat
(C:\Program Files\Apache Software Foundation\apache-tomcat-8.0.8\bin\tomcat8.exe; PE32+ executable for MS Windows (console) Mono/.Net assembly) which are neither Java based nor using java, while java is required to run these programs. -
barlop almost 10 yearsPerhaps you could ask in stackoverflow if eclipse and apache ds use java in a fundamentally different way such that the file command sees them differently.. And what is the difference in how java can be used, to cause that difference with the file command
-
030 almost 10 years
-
barlop almost 10 yearsLet us continue this discussion in chat.
-
-
030 almost 10 yearsThis command indicates that eclipse is using java. When Eclipse has been killed, the command indicates that none of the programs are using java, while firefox is running and apacheds is still listening on port 10389.
-
030 almost 10 yearsThis command does indicate that
some
processes are using java. It is not able to showall processes which are using java
. -
Zdzisiek almost 10 yearsIt is because
jcmd
shows processes working in that moment. Firefox starts java only to run applet and then don't use java after that. I don't known any universal method to find all processes which occasionally use java. But process which don't use java in that moment shouldn't block install new version of java (but I don't test this).