title: Launch and control javafx GUI from another class
body: <p>I have one class/file, ui/.class, which extends Application and deals with the ui of my program. I also have another class file, core/.class, which I want to deal with all the logic of the program. So, in core.class I have:</p>
  
  <pre><code>class core{
     public static void main(String[] args){
        ui GUI = new ui();
        GUI.launch();
     }
  }
  </code></pre>
  
  <p>This compiles fine, but gives a runtime error:</p>
  
  <pre><code>Exception in thread "main" java.lang.RuntimeException: Error: class core is not a subclass of javafx.application.Application
  </code></pre>
  
  <p>Should my core class extend Application? If so, why?</p>
  
  <p>EDIT: Here's the ui class:</p>
  
  <pre><code>import javafx.application.Application;
  
  import javafx.stage.*;
  
  import javafx.scene.*;
  import javafx.scene.layout.*;
  
  
  public class ui extends Application{
      public void start(Stage mainStage){
          mainStage.setTitle("UI Test");      
          BorderPane mainPane = new BorderPane();     
          Scene mainScene = new Scene(mainPane);
          mainStage.setScene(mainScene);
          mainStage.show();
      }
  }
  </code></pre>