title: Which API does Java's jps tool use internally?
body: <p>I need to recreate the functionalities of the jps tool programmatically. I need to find out all Java running processes along with their id so I can attach to that process (similar to what JConsole does).  </p>
  
  <p>I thought the VirtualMachine API would help, but did not get expected result when I run the following</p>
  
  <pre><code>public class ProcessList {
      public static void main(String[] args){
          List&lt;VirtualMachineDescriptor&gt; vms = VirtualMachine.list();
          for(VirtualMachineDescriptor vm : vms){
              System.out.println (vm.id());
          }
      }
  }
  </code></pre>
  
  <p>When I run the code above, it returns just one ID, but when I run jps on the same machine I see several other processes.</p>