title: Root cannot be null
body: <p>I am trying to open a new window. Specifying the controller programmatically.</p>
  
  <pre><code>OverviewController overviewController = new OverviewController();
  
  final FXMLLoader loader = new FXMLLoader(getClass().getClassLoader().getResource("overview.fxml"));
  loader.setController(overviewController);
  
  Parent root = loader.getRoot(); // Gives me a "Root cannot be null" error...
  
  Stage stage = new Stage();
  Scene scene = new Scene(root);
  
  stage.setTitle("FXML Welcome");
  stage.setScene(scene);
  stage.setResizable(false);
  stage.show();
  </code></pre>
  
  <p>So it goes wrong after loading the root.</p>
  
  <p>The following code does work, but i want to specify my own controller in the code.</p>
  
  <pre><code>Parent root = null;
  
  try {
      root = FXMLLoader.load(getClass().getClassLoader().getResource("overview.fxml"));
  
      Stage stage = new Stage();
      Scene scene = new Scene(root);
  
      stage.setTitle("FXML Welcome");
      stage.setScene(scene);
      stage.setResizable(false);
      stage.show();
  } catch (IOException e) {
      e.printStackTrace();
  }
  </code></pre>