code: public List<ProcessDescription> listProcesses() throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {
          List<ProcessDescription> ret = new ArrayList<ProcessDescription>();
          Class vmClass = lookupVirtualMachineClass();
          Method method = vmClass.getMethod("list");
          List vmDescriptors = (List) method.invoke(null);
          for (Object descriptor : vmDescriptors) {
              Method idMethod = descriptor.getClass().getMethod("id");
              String id = (String) idMethod.invoke(descriptor);
              Method displayMethod = descriptor.getClass().getMethod("displayName");
              String display = (String) displayMethod.invoke(descriptor);
              ret.add(new ProcessDescription(id, display));
          }
          return ret;
      }
docs: Return a list of all Java processes
  @return list of java processes
  @throws NoSuchMethodException reflection error
  @throws InvocationTargetException reflection error
  @throws IllegalAccessException reflection error