title: Execute Java main method from within a Java desktop app in a different JVM
body: <p>I have a desktop app and when someone presses a button I want it to kick off another JVM that executes a class' main method.  My desktop app already depends on the jar that contains the class with the main method that I want to execute. </p>
  
  <p>Currently I've got the following code, however, I was hoping their was a more elegant way of doing this:</p>
  
  <pre><code>Runtime runtime = Runtime.getRuntime();
  Process process = runtime.exec("java -jar another.jar");
  </code></pre>
  
  <p>I know I can use ProcessBuilder too. </p>
  
  <p>Is there no way such as (excuse the pseudo code):</p>
  
  <pre><code>Jvm.execute(Main.class);
  </code></pre>
  
  <p>Since the Main class that I want to call already exists in my classpath, it just feels weird to have to run the <code>java</code> command via Runtime.</p>