title: Not able to run as Exception in Application start method
body: <p>I am using Netbeans IDE and created that file using Scene Builder 2.0. I created all the user interface using Scene Builder.</p>
  
  <p>When I try to run the application this exception comes. I created JavaFX FXML application in Netbeans IDE and opened the fxml in scene builder and edited and after completion ran it in Netbeans but failed to get the desired screen.</p>
  
  <p><strong>ERROR:</strong></p>
  
  <pre><code>Executing C:\J_Progs\Login\dist\run1115386562\Login.jar using platform C:\Program Files\Java\jdk1.8.0_66\jre/bin/java
  Exception in Application start method
  java.lang.reflect.InvocationTargetException
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:497)
      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(NativeMethodAccessorImpl.java:62)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:497)
      at sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:767)
  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$155(LauncherImpl.java:182)
      at java.lang.Thread.run(Thread.java:745)
  Caused by: javafx.fxml.LoadException: 
  file:/C:/J_Progs/Login/dist/run1115386562/Login.jar!/login/Login.fxml:35
  
      at javafx.fxml.FXMLLoader.constructLoadException(FXMLLoader.java:2601)
      at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2579)
      at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2441)
      at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3214)
      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 login.Login.start(Login.java:23)
      at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$162(LauncherImpl.java:863)
      at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$175(PlatformImpl.java:326)
      at com.sun.javafx.application.PlatformImpl.lambda$null$173(PlatformImpl.java:295)
      at java.security.AccessController.doPrivileged(Native Method)
      at com.sun.javafx.application.PlatformImpl.lambda$runLater$174(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$148(WinApplication.java:191)
      ... 1 more
  Caused by: java.lang.IllegalArgumentException: Can not set javafx.scene.control.Label field login.LoginController.txtUser to javafx.scene.control.TextField
      at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:167)
      at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:171)
      at sun.reflect.UnsafeObjectFieldAccessorImpl.set(UnsafeObjectFieldAccessorImpl.java:81)
      at java.lang.reflect.Field.set(Field.java:764)
      at javafx.fxml.FXMLLoader.injectFields(FXMLLoader.java:1163)
      at javafx.fxml.FXMLLoader.access$1600(FXMLLoader.java:103)
      at javafx.fxml.FXMLLoader$ValueElement.processValue(FXMLLoader.java:857)
      at javafx.fxml.FXMLLoader$ValueElement.processStartElement(FXMLLoader.java:751)
      at javafx.fxml.FXMLLoader.processStartElement(FXMLLoader.java:2707)
      at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2527)
      ... 17 more
  Exception running application login.Login
  </code></pre>
  
  <p><strong>Login.fxml</strong>:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  
  &lt;?import javafx.scene.paint.*?&gt;
  &lt;?import javafx.scene.shape.*?&gt;
  &lt;?import javafx.scene.effect.*?&gt;
  &lt;?import javafx.scene.text.*?&gt;
  &lt;?import java.lang.*?&gt;
  &lt;?import java.util.*?&gt;
  &lt;?import javafx.scene.*?&gt;
  &lt;?import javafx.scene.control.*?&gt;
  &lt;?import javafx.scene.layout.*?&gt;
  
  &lt;AnchorPane id="AnchorPane" prefHeight="600.0" prefWidth="650.0" style="-fx-background-color: #DCDCDC;" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="login.LoginController"&gt;
     &lt;children&gt;
        &lt;Label fx:id="lblMsg" layoutX="47.0" layoutY="39.0" text="WELCOME" textAlignment="CENTER"&gt;
           &lt;font&gt;
              &lt;Font name="System Bold" size="40.0" /&gt;
           &lt;/font&gt;
        &lt;/Label&gt;
        &lt;Label layoutX="271.0" layoutY="229.0" text="SIGN IN"&gt;
           &lt;font&gt;
              &lt;Font name="System Bold" size="24.0" /&gt;
           &lt;/font&gt;
        &lt;/Label&gt;
        &lt;Label layoutX="130.0" layoutY="300.0" text="USERNAME"&gt;
           &lt;font&gt;
              &lt;Font size="15.0" /&gt;
           &lt;/font&gt;
        &lt;/Label&gt;
        &lt;Label layoutX="129.0" layoutY="379.0" text="PASSWORD"&gt;
           &lt;font&gt;
              &lt;Font size="15.0" /&gt;
           &lt;/font&gt;
        &lt;/Label&gt;
        &lt;TextField fx:id="txtUser" layoutX="265.0" layoutY="298.0" prefHeight="25.0" prefWidth="235.0" promptText="Enter Username" /&gt;
        &lt;Button layoutX="289.0" layoutY="481.0" mnemonicParsing="false" onAction="#loginAction" opacity="0.84" style="-fx-background-color: #1e90ff;" text="SIGN IN" textFill="WHITE"&gt;
           &lt;font&gt;
              &lt;Font size="15.0" /&gt;
           &lt;/font&gt;
        &lt;/Button&gt;
        &lt;PasswordField fx:id="txtPass" layoutX="265.0" layoutY="377.0" prefHeight="25.0" prefWidth="235.0" promptText="Enter Password" /&gt;
        &lt;Rectangle arcHeight="18.0" arcWidth="18.0" fill="SILVER" height="174.0" layoutX="83.0" layoutY="264.0" opacity="0.41" stroke="BLACK" strokeType="INSIDE" width="506.0" /&gt;
        &lt;Rectangle arcHeight="12.0" arcWidth="12.0" fill="DODGERBLUE" height="35.0" layoutX="86.0" layoutY="229.0" opacity="0.67" stroke="BLACK" strokeType="INSIDE" width="500.0" /&gt;
     &lt;/children&gt;
  &lt;/AnchorPane&gt;
  </code></pre>
  
  <p><strong>LoginController.java</strong>:</p>
  
  <pre><code>/*
   * To change this license header, choose License Headers in Project Properties.
   * To change this template file, choose Tools | Templates
   * and open the template in the editor.
   */
  package login;
  
  import java.net.URL;
  import java.util.ResourceBundle;
  import javafx.event.ActionEvent;
  import javafx.fxml.FXML;
  import javafx.fxml.Initializable;
  import javafx.scene.control.Label;
  
  
  
  public class LoginController implements Initializable {
  
      @FXML
      private Label lblMsg;
      @FXML
      private Label txtUser;
      @FXML
      private Label txtPass;
  
  
      @FXML
      private void loginAction(ActionEvent event) {
          if(txtUser.getText().equals("rs954") &amp;&amp; txtPass.getText().equals("admin"))
          {
              lblMsg.setText("WELCOME");
          }    
          else
          {
              lblMsg.setText("WRONG CREDENTIALS");
          }    
          }    
  
      @Override
      public void initialize(URL location, ResourceBundle resources) {
          throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
      } 
  }
  </code></pre>
  
  <p><strong>Login.java</strong>:</p>
  
  <pre><code>/*
   * To change this license header, choose License Headers in Project Properties.
   * To change this template file, choose Tools | Templates
   * and open the template in the editor.
   */
  package login;
  
  import java.io.IOException;
  import javafx.application.Application;
  import javafx.fxml.FXMLLoader;
  import javafx.scene.Parent;
  import javafx.scene.Scene;
  import javafx.stage.Stage;
  
  
  
  public class Login extends Application {
  
      @Override
      public void start(Stage primaryStage) throws IOException {
          Parent root = FXMLLoader.load(getClass().getResource("Login.fxml"));
  
          primaryStage.setScene(new Scene(root));
          primaryStage.show();
      }
  
      /**
       * @param args the command line arguments
       */
      public static void main(String[] args) {
          launch(args);
      }
  
  }
  </code></pre>
  
  <p><strong>NEW ERROR:</strong></p>
  
  <pre><code>Executing C:\J_Progs\Login\dist\run384200010\Login.jar using platform C:\Program Files\Java\jdk1.8.0_66\jre/bin/java
  Exception in Application start method
  java.lang.reflect.InvocationTargetException
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:497)
      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(NativeMethodAccessorImpl.java:62)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:497)
      at sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:767)
  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$155(LauncherImpl.java:182)
      at java.lang.Thread.run(Thread.java:745)
  Caused by: javafx.fxml.LoadException: 
  file:/C:/J_Progs/Login/dist/run384200010/Login.jar!/login/Login.fxml
  
      at javafx.fxml.FXMLLoader.constructLoadException(FXMLLoader.java:2601)
      at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2579)
      at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2441)
      at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3214)
      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 login.Login.start(Login.java:23)
      at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$162(LauncherImpl.java:863)
      at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$175(PlatformImpl.java:326)
      at com.sun.javafx.application.PlatformImpl.lambda$null$173(PlatformImpl.java:295)
      at java.security.AccessController.doPrivileged(Native Method)
      at com.sun.javafx.application.PlatformImpl.lambda$runLater$174(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$148(WinApplication.java:191)
      ... 1 more
  Caused by: java.lang.UnsupportedOperationException: Not supported yet.
      at login.LoginController.initialize(LoginController.java:44)
      at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2548)
      ... 17 more
  
  Exception running application login.Login
  </code></pre>
  
  <p><strong>NEW EDIT IN LoginController.java</strong></p>
  
  <pre><code>/*
   * To change this license header, choose License Headers in Project Properties.
   * To change this template file, choose Tools | Templates
   * and open the template in the editor.
   */
  package login;
  
  import java.net.URL;
  import java.util.ResourceBundle;
  import javafx.event.ActionEvent;
  import javafx.fxml.FXML;
  import javafx.fxml.Initializable;
  import javafx.scene.control.Label;
  import javafx.scene.control.TextField;
  
  
  public class LoginController implements Initializable {
  
      @FXML
      private Label lblMsg = new Label();
      @FXML
      private TextField txtUser = new TextField ();
      @FXML
      private TextField txtPass = new TextField ();
  
  
      @FXML
      private void loginAction(ActionEvent event) {
          if(txtUser.getText().equals("rs95    4") &amp;&amp; txtPass.getText().equals("admin"))
          {
              lblMsg.setText("WELCOME");
          }    
          else
          {
              lblMsg.setText("WRONG CREDENTIALS");
          }    
      }    
  
      @Override
      public void initialize(URL location, ResourceBundle resources) {
          throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
      } 
  }
  </code></pre>