I'm working on a JavaFX project using NetBeans, and I've encountered an issue with loading an FXML file. Originally, my VentanaLogin.fxml file was in the practica6.main package, but I moved it to a new package practica6.vista to better organize the project.
Updating property file: C:\Users\Usuario\Documents\NetBeansProjects\Practica6_Parte3\build\built-jar.properties
Compiling 1 source file to C:\Users\Usuario\Documents\NetBeansProjects\Practica6_Parte3\build\classes
compile-single:
run-single:
Exception in Application start method
java.lang.reflect.InvocationTargetException
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:569)
at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:464)
at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:364)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:569)
at java.base/sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:1091)
Caused by: java.lang.RuntimeException: Exception in Application start method
at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:893)
at javafx.graphics/com.sun.javafx.application.LauncherImpl.lambda$launchApplication$2(LauncherImpl.java:196)
at java.base/java.lang.Thread.run(Thread.java:840)
Caused by: java.lang.NullPointerException: Location is required.
at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3374)
at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3337)
at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3305)
at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3277)
at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3253)
at javafx.fxml/javafx.fxml.FXMLLoader.load(FXMLLoader.java:3246)
at practica6.main.main.start(main.java:37)
at javafx.graphics/com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$9(LauncherImpl.java:839)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runAndWait$12(PlatformImpl.java:483)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$10(PlatformImpl.java:456)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$11(PlatformImpl.java:455)
at javafx.graphics/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
at javafx.graphics/com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at javafx.graphics/com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(WinApplication.java:184)
... 1 more
Exception running application practica6.main.main
C:\Users\Usuario\Documents\NetBeansProjects\Practica6_Parte3\nbproject\build-impl.xml:1367: The following error occurred while executing this line:
C:\Users\Usuario\Documents\NetBeansProjects\Practica6_Parte3\nbproject\build-impl.xml:962: Java returned: 1
BUILD FAILED (total time: 2 seconds)
The FXML file is located at src/practica6/vista/VentanaLogin.fxml.
In my Main class, I load the FXML like this:
FXMLLoader.load(getClass().getResource("/practica6/vista/VentanaLogin.fxml"));
This is the general structure on my packages
However, the program still fails to load the FXML file. I have tried cleaning and rebuilding the project, but the issue persists. Does anyone know what could be causing this error or what I may have missed when moving the FXML file to a new package?

srcfolder, it should be together with all the compiled Java classes, i.e. files with the.classextension. I don't use NetBeans, I use Eclipse and as part of the build process (not Maven), Eclipse copies resource folders to the build destination folder.fx:controller="...". So, basically, you want to paste your old FXML code, but make sure you replace the oldfx:controller="..."with the newly created one.