title: Exception running application sample.Main
body: <p>I am making a ToDo App in JavaFX but it says this error (even without the database, login system just want to run it plainly):
  I like to code but not when errors come up <strong>Thats why i am called ErrorLane</strong></p>
  <p>Main.java:</p>
  <pre><code>package sample;
  
  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(&quot;C:\\Users\\arhaan\\eclipse-workspace\\ToDoApp\\src\\sample\\viewlogin.fxml&quot;));
          primaryStage.setTitle(&quot;Hello World&quot;);
          primaryStage.setScene(new Scene(root, 300, 275));
          primaryStage.show();
      }
  
  
      public static void main(String[] args) {
          launch(args);
      }
  }
  </code></pre>
  <p>login.fxml:</p>
  <pre><code>&lt;?import javafx.geometry.Insets?&gt;
  &lt;?import javafx.scene.layout.GridPane?&gt;
  
  &lt;?import javafx.scene.control.Button?&gt;
  &lt;?import javafx.scene.control.Label?&gt;
  &lt;?import javafx.scene.control.TextField?&gt;
  &lt;GridPane fx:controller=&quot;sample.Controller&quot;
            xmlns:fx=&quot;http://javafx.com/fxml&quot; fx:controller=&quot;application.FXMLDocumentController&quot; alignment=&quot;center&quot; hgap=&quot;10&quot; vgap=&quot;10&quot;&gt;
  &lt;/GridPane&gt;
  </code></pre>
  <p>It is in <strong>Eclipse</strong> not <strong>IntelliJ IDEA</strong> with JRE 1.8.0</p>
  <p>This is the error:</p>
  <pre><code>Exception in Application start method
  java.lang.reflect.InvocationTargetException
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      at java.lang.reflect.Method.invoke(Unknown Source)
      at com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:389)
      at com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:328)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      at java.lang.reflect.Method.invoke(Unknown Source)
      at sun.launcher.LauncherHelper$FXHelper.main(Unknown Source)
  Caused by: java.lang.RuntimeException: Exception in Application start method
      at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:917)
      at com.sun.javafx.application.LauncherImpl.lambda$launchApplication$1(LauncherImpl.java:182)
      at java.lang.Thread.run(Unknown Source)
  Caused by: java.lang.NullPointerException: Location is required.
      at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3207)
      at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3175)
      at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3148)
      at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3124)
      at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3104)
      at javafx.fxml.FXMLLoader.load(FXMLLoader.java:3097)
      at sample.Main.start(Main.java:13)
      at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$8(LauncherImpl.java:863)
      at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$7(PlatformImpl.java:326)
      at com.sun.javafx.application.PlatformImpl.lambda$null$5(PlatformImpl.java:295)
      at java.security.AccessController.doPrivileged(Native Method)
      at com.sun.javafx.application.PlatformImpl.lambda$runLater$6(PlatformImpl.java:294)
      at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
      at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
      at com.sun.glass.ui.win.WinApplication.lambda$null$4(WinApplication.java:186)
      ... 1 more
  Exception running application sample.Main
  </code></pre>