title: JavaFX warning: Argument 'getClass().getClassLoader().getResource( "view/RootLayout.fxml" )' might be null
body: <p>IntelliJ Idea is giving me this warning:  </p>
  
  <pre><code>Argument 'getClass().getClassLoader().getResource( "view/RootLayout.fxml" )' might be null
  </code></pre>
  
  <p>However, it always works.  I just want the clear warning, preferably without annotations or disabling the inspection.</p>
  
  <p>Per this thread: <a href="https://stackoverflow.com/questions/26328040/intellij-idea-getclass-getresource-return-null">IntelliJ IDEA - getClass().getResource(&quot;...&quot;) return null</a></p>
  
  <ul>
  <li>I have my resources folder set as a Resources Root.</li>
  <li>I added *.fxml to Settings -> Build, Execution, Deployment -> Compiler -> Resource patterns </li>
  <li>I even added ?<em>.fxml and !?</em>.fxml to cover more possibilities.</li>
  </ul>
  
  <p>None of those seem to make any difference.</p>
  
  <p>Here is my start() method:</p>
  
  <pre><code>@Override
  public void start( Stage primaryStage ) throws Exception
  {
      // Load the FXML file containing all of the UI elements.
      FXMLLoader loader = new FXMLLoader();
      loader.setLocation( getClass().getResource( "view/RootLayout.fxml" ) );
      Parent root = FXMLLoader.load( getClass().getClassLoader().getResource( "view/RootLayout.fxml" ) );
  
      // Create the stage and set the window title.
      primaryStage.setTitle( "SNMP Link Utilization" );
  
      // Set the scene using root, with the specified width and height.
      primaryStage.setScene( new Scene( root, 500, 600 ) );
  
      // Set the icon for a non-Maven build.
      //primaryStage.getIcons().add( new Image( "file:resources/images/nic.png" ) );
      // Set the icon for a Maven build.
      primaryStage.getIcons().add( new Image( "images/nic.png" ) );
  
      primaryStage.show();
  }
  </code></pre>
  
  <p>Am I doing anything wrong?  I've tried a few other ways of creating the Parent object, but all that I have tried end up failing.</p>