I'm trying to test a program to Log in or register a person. But I keep getting the same Exception.(InvocationTargetException) :
Exception in Application start method
java.lang.reflect.InvocationTargetException
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:119)
at java.base/java.lang.reflect.Method.invoke(Method.java:578)
at javafx.graphics@19/com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:465)
at javafx.graphics@19/com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:364)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
at java.base/java.lang.reflect.Method.invoke(Method.java:578)
at java.base/sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:1081)
Caused by: java.lang.RuntimeException: Exception in Application start method
at javafx.graphics@19/com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:901)
at javafx.graphics@19/com.sun.javafx.application.LauncherImpl.lambda$launchApplication$2(LauncherImpl.java:196)
at java.base/java.lang.Thread.run(Thread.java:1589)
Caused by: java.lang.NullPointerException: Location is required.
at javafx.fxml@19/javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3324)
at javafx.fxml@19/javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3287)
at javafx.fxml@19/javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3255)
at javafx.fxml@19/javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3227)
at javafx.fxml@19/javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3203)
at javafx.fxml@19/javafx.fxml.FXMLLoader.load(FXMLLoader.java:3196)
at librarymanagement.FXMain.start(FXMain.java:22)
at javafx.graphics@19/com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$9(LauncherImpl.java:847)
at javafx.graphics@19/com.sun.javafx.application.PlatformImpl.lambda$runAndWait$12(PlatformImpl.java:484)
at javafx.graphics@19/com.sun.javafx.application.PlatformImpl.lambda$runLater$10(PlatformImpl.java:457)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
at javafx.graphics@19/com.sun.javafx.application.PlatformImpl.lambda$runLater$11(PlatformImpl.java:456)
at javafx.graphics@19/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:96)
at javafx.graphics@19/com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at javafx.graphics@19/com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(WinApplication.java:184)
... 1 more
Exception running application librarymanagement.FXMain
FXML File:
<?xml version="1.0" encoding="UTF-8"?>
<?import de.jensd.fx.glyphs.fontawesome.FontAwesomeIconView?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.PasswordField?>
<?import javafx.scene.control.TextField?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.text.Font?>
<AnchorPane id="AnchorPane" prefHeight="469.0" prefWidth="691.0" styleClass="login-form" stylesheets="@designLogin.css" xmlns="http://javafx.com/javafx/19" xmlns:fx="http://javafx.com/fxml/1">
<children>
<AnchorPane layoutX="102.0" layoutY="63.0" prefHeight="344.0" prefWidth="487.0" styleClass="card-form" stylesheets="@designLogin.css">
<children>
<FontAwesomeIconView fill="WHITE" glyphName="USERS" layoutX="209.0" layoutY="78.0" selectionFill="#f29eec" size="5em" text="" />
<Label layoutX="207.0" layoutY="102.0" text="Login" textFill="WHITE">
<font>
<Font name="Berlin Sans FB" size="30.0" />
</font>
</Label>
<TextField layoutX="152.0" layoutY="159.0" prefHeight="25.0" prefWidth="180.0" promptText="Student Id" styleClass="textfield" stylesheets="@designLogin.css" />
<PasswordField layoutX="151.0" layoutY="194.0" prefHeight="25.0" prefWidth="180.0" promptText="Password" styleClass="textfield" stylesheets="@designLogin.css" />
<Button layoutX="214.0" layoutY="242.0" mnemonicParsing="false" styleClass="login-btn" stylesheets="@designLogin.css" text="Signup" />
</children>
</AnchorPane>
<Button layoutX="617.0" layoutY="51.0" mnemonicParsing="false" prefHeight="24.0" prefWidth="25.0" styleClass="close" stylesheets="@designLogin.css" AnchorPane.rightAnchor="2.0" AnchorPane.topAnchor="2.0">
<graphic>
<FontAwesomeIconView fill="WHITE" glyphName="CLOSE" size="1.2em" text="" textAlignment="CENTER" wrappingWidth="15.980972915887833" />
</graphic>
</Button>
<Button layoutX="624.0" layoutY="2.0" mnemonicParsing="false" prefHeight="24.0" prefWidth="32.0" styleClass="minimize" stylesheets="@designLogin.css">
<graphic>
<FontAwesomeIconView fill="WHITE" glyphName="MINUS" textAlignment="CENTER" wrappingWidth="16.095197677612305" />
</graphic>
</Button>
</children>
</AnchorPane>
CSS File: /* Created on : 13 janv. 2023, 20:47:39 Author : chahrazed.benazaiez */
.login-form{
-fx-background-color:linear-gradient(to bottom right, #2a2438, #352f44);
}
.card-form{
-fx-background-color:#5c5470;
-fx-background-radius:15px;
}
.close{
-fx-background-color:transparent;
-fx-cursor:hand;
}
.close:hover{
-fx-background-color:#dbd8e3;
}
.minimize{
-fx-background-color:transparent;
-fx-cursor:hand;
}
.minimize:hover{
-fx-background-color:#dbd8e3;
}
.textfield{
-fx-background-color:transparent;
-fx-text-inner-color:#fff;
-fx-border-color:#fff;
-fx-border-width:0px 0px .4px 0px;
-fx-font-size:13px;
}
.textfield:focused{
-fx-border-width:0px 0px 1px 0px;
}
.login-btn{
-fx-background-color:#dbd8e3;
-fx-background-radius:15px;
-fx-cursor:hand;
-fx-font-size:15px;
}
.login-btn:hover{
-fx-background-color:#ffe9e3;
}
I couldn't find where the issue is. Can anyone help me out, please? (Thanks in advance ^^)
I am expecting the Login Window to appear conveniently.