title: Check if process is java process in Windows
body: <p>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 <code>java.exe</code> process from the standard java installation e.g. bundled <code>java.exe</code> 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.</p>
  
  <p>I have tried getting the CommandLine of the process and checking if the first argument ends with <code>java.exe</code> or <code>javaw.exe</code>, but the issue is that this can be faked a process that also happens to be called <code>java.exe</code> but is not an instance of the JVM.</p>