0

How to check if a process, given the process id, is a legitimate Java application process on Windows. Legitimate, meaning an instance of a JVM that might not be the java.exe process from the standard java installation e.g. bundled java.exe from installations like IntelliJ IDEA. Some of these JVMs might not even be Oracle JVMs, but OpenJDK or IBM versions. But for simplicity's sake, let's assume Oracle JVMs.

I have tried getting the CommandLine of the process and checking if the first argument ends with java.exe or javaw.exe, but the issue is that this can be faked a process that also happens to be called java.exe but is not an instance of the JVM.

  • Does this answer your question? [How to detect via Java whether a particular process is running under Windows?](https://stackoverflow.com/questions/2318220/how-to-detect-via-java-whether-a-particular-process-is-running-under-windows) – avocadoLambda May 17 '20 at 09:21
  • Short: You can't, at least reliably. – Michael Chourdakis May 17 '20 at 11:52

0 Answers0