3

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?

8
  • 1
    One 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.
    – barlop
    Commented Jun 14, 2014 at 18:18
  • The 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 in C:\Program Files\Java\jdk1.8.0_05\bin\java.exe; PE32+ executable for MS Windows (console) Mono/.Net assembly.
    – 030
    Commented Jun 15, 2014 at 1:33
  • That means java,exe is not written in java. And that makes sense that java.exe wouldn't be written in java.
    – barlop
    Commented Jun 15, 2014 at 5:00
  • The 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) and Tomcat (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.
    – 030
    Commented Jun 15, 2014 at 9:02
  • 1
    Perhaps 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
    – barlop
    Commented Jun 15, 2014 at 9:20

1 Answer 1

4

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.

3
  • This 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
    Commented Jun 14, 2014 at 18:48
  • This command does indicate that some processes are using java. It is not able to show all processes which are using java.
    – 030
    Commented Jun 15, 2014 at 9:04
  • It 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).
    – Zdzisiek
    Commented Jun 15, 2014 at 16:52

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .