title: Is it possible in Java to Invoke another class' main method and return to the invoking code?
body: <pre><code>public class A{
      public static void main(String[] args)
      {
          //Main code
      }
  }
  
  public class B{
      void someMethod()
      {
          String[] args={};
          A.main();
          System.out.println("Back to someMethod()");
      }
  }
  </code></pre>
  
  <p><br>
  Is there any way to do this? I found a method of doing the same using reflection but that doesn't return to the invoking code either. I tried using <code>ProcessBuilder</code> to execute it in a separate process but I guess I was missing out something.</p>