title: JavaFX "Location is required." even though it is in the same package
body: <p>I am trying to get my JavaFX program to run but am having some difficulty. I keep getting an error of 'java.lang.NullPointerException: Location is required.' The fxml file is in the same package as Application class. Here is my very simple code:</p>
  
  <pre><code>package com.kromalights.designer.entry;
  
  import javafx.application.Application;
  import javafx.fxml.FXMLLoader;
  import javafx.scene.Parent;
  import javafx.scene.Scene;
  import javafx.stage.Stage;
  
  public class Main extends Application {
  
      @Override
      public void start(Stage primaryStage) throws Exception{
          Parent root = FXMLLoader.load(getClass().getResource("main.fxml"));
          primaryStage.setTitle("Kromalights Designer");
          primaryStage.setScene(new Scene(root, 300, 275));
          primaryStage.show();
      }
  
  
      public static void main(String[] args) {
          launch(args);
      }
  }
  </code></pre>
  
  <p>And here is a copy of my main.fxml file:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  
  &lt;?import java.lang.*?&gt;
  &lt;?import javafx.scene.layout.*?&gt;
  &lt;?import javafx.scene.layout.BorderPane?&gt;
  &lt;?scenebuilder-stylesheet mailStyles.css?&gt;
  &lt;?import java.net.*?&gt;
  
  &lt;BorderPane prefHeight="300.0" prefWidth="300.0" xmlns:fx="http://javafx.com/fxml/1"
          xmlns="http://javafx.com/javafx/2.2"
          fx:controller="com.kromalights.designer.entry.Controller"&gt;
      &lt;bottom&gt;
          &lt;Pane prefHeight="200.0" prefWidth="200.0"/&gt;
      &lt;/bottom&gt;
      &lt;center&gt;
          &lt;Pane prefHeight="200.0" prefWidth="200.0"/&gt;
      &lt;/center&gt;
      &lt;left&gt;
          &lt;VBox prefHeight="200.0" prefWidth="100.0"/&gt;
      &lt;/left&gt;
      &lt;top&gt;
          &lt;HBox prefHeight="100.0" prefWidth="200.0"/&gt;
      &lt;/top&gt;
      &lt;stylesheets&gt;
          &lt;URL value="@mainStyles.css" /&gt;
      &lt;/stylesheets&gt;
  &lt;/BorderPane&gt;
  </code></pre>
  
  <p>The controller class does exist and is in the package specified in the fxml file. All of my names are correct and are where I think they should be. What am I missing? I did try renaming my fxml file in case it was a name issue. Please help. FYI, I am using Intellij IDEA on OSX.</p>
  
  <p>UPDATE: This is a Maven issue. I setup Maven for this project and that caused the issue. I removed Maven temporarily so I can continue working without it. Does anyone have any insight as to how I would best handle this when using Maven?</p>