title: JavaFx FXML load file issues with setting root
body: <p>New to javaFx and wanting to use scenebuilder for GUI development, i've come across an issue with no luck searching the website nor the web in general for my problem, although similar questions have been asked, thought a different perspective could be needed. I am trying to load an FXML file through Netbeans after a quick build to test functionality so the code is simple, but i cannot get the root file to be set in the controller.  my code is the following
      public class Divergex extends Application {</p>
  
  <pre><code>@Override
  public void start(Stage stage) throws Exception {
      Parent root = FXMLLoader.load(getClass().getResource("DivergexGUI.fxml"));
  
  
      Scene scene = new Scene(root);
      scene.setRoot(root);
  
      stage.setScene(scene);
      stage.show();
  }
  </code></pre>
  
  <p>Ive tried suggestions in changing fxroot to a Vbox with no luck, i continue to get a Load exception on the compile :</p>
  
  <blockquote>
    <p>Exception in Application start method...
    Caused by: javafx.fxml.LoadException: Root hasn't been set. Use method setRoot() before load.</p>
  </blockquote>
  
  <p>yet when i use </p>
  
  <pre><code>scene.setRoot(root); 
  </code></pre>
  
  <p>the same exception is experienced</p>
  
  <p>i've narrowed the issue down to the fact that my FXML file is unable to be set as a root in the Parent object but have had no luck in tackling this.  Any suggestions would be great thanks.</p>