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.