title: JavaFX launch another application
body: <p>I've been smashing my head with JavaFx...</p>
  
  <p>This works for when there's no instances of an application running:</p>
  
  <pre><code>public class Runner {
  
      public static void main(String[] args) {
          anotherApp app = new anotherApp();
          new Thread(app).start();
      }
   }
  
  public class anotherApp extends Application implements Runnable {
  
      @Override
      public void start(Stage stage) {
      }
  
      @Override
      public void run(){
          launch();
      }
  }
  </code></pre>
  
  <p>But if I do <code>new Thread(app).start()</code> <em>within</em> another application I get an exception stating that I can't do two launches.</p>
  
  <p>Also my method is called by an observer on the other application like this:</p>
  
  <pre><code>@Override
  public void update(Observable o, Object arg) {
      // new anotherApp().start(new Stage());
              /* Not on FX application thread; exception */
  
      // new Thread(new anotherApp()).start();
              /* java.lang.IllegalStateException: Application launch must not be called more than once */
  }
  </code></pre>
  
  <p>It's within a JavaFX class such as this:</p>
  
  <pre><code>public class Runner extends Applications implements Observer {
  
      public static void main(String[] args) {
          launch(args);
      }
  
      @Override
      public void start(Stage stage){
      //...code...//
      }
      //...methods..//
      //...methods..//
  
      @Override
      public void update(Observable o, Object arg) {
      //the code posted above//
      }
  }
  </code></pre>
  
  <p>I tried using ObjectProperties with listeners but it didn't work. I need to get this new stage running from within the update method from java.util.observer in some way.</p>
  
  <p>Any suggestions are welcomed. Thanks.</p>