0

Whenever I start a new FXML application and try to run the main I get this error message:

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:498)
    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:498)
    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$159(LauncherImpl.java:182)
    at java.lang.Thread.run(Thread.java:748)
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 javafxapplication9.JavaFXApplication9.start(JavaFXApplication9.java:22)
    at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$166(LauncherImpl.java:863)
    at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$179(PlatformImpl.java:326)
    at com.sun.javafx.application.PlatformImpl.lambda$null$177(PlatformImpl.java:295)
    at java.security.AccessController.doPrivileged(Native Method)
    at com.sun.javafx.application.PlatformImpl.lambda$runLater$178(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$152(WinApplication.java:177)
    ... 1 more
Exception running application javafxapplication9.JavaFXApplication9
C:\Users\Kacper\Documents\NetBeansProjects\JavaFXApplication9\nbproject\build-impl.xml:1052: The following error occurred while executing this line:
C:\Users\Kacper\Documents\NetBeansProjects\JavaFXApplication9\nbproject\build-impl.xml:806: Java returned: 1

I'm using scenebuilder to edit FXML document, and everything used to work fine. I've tried uninstalling and reinstalling both netbeans IDE and scenebuilder, but it didn't help. All other types of projects seem to work fine. I don't know how and why it broke, but maybe it has something to do with me uninstalling Oracle DB 18c recently.

2 Answers 2

1

I got that error every time I renamed my package or moved the FXML files to another package.

Right-click on your FXML file, select edit, then look for a line that looks like this: fx:controller="schoolmanagement.ui.login.FXMLDocumentController"> (depends on your package name. Mine was schoolmanagement.ui.login). Make sure the string matches the package name under which that FXMLDocument is found. That worked for me. Hope it helps.

0

I also had this problem and I tried several of the other solutions offered on Stackoverflow, which didn't work for me. Based on this: https://netbeans.org/bugzilla/show_bug.cgi?id=241405. I tried to Clean and Build my project in Netbeans 11.0 and suddenly my project ran without a problem. Seems to be a Netbeans quirk. As you are using Netbeans, maybe it can help in your case too?

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .