尝试在 e(fx)clipse 中移动 FXML 文件时出错

Error when trying to move FXML files in e(fx)clipse

我有这段代码和这个文件层次结构: 一切似乎都很好,但我收到此错误日志:

java.lang.NullPointerException: Location is required.
    at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3201)
    at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3169)
    at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3142)
    at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3118)
    at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3098)
    at javafx.fxml.FXMLLoader.load(FXMLLoader.java:3091)
    at com.model.tomaszm.Main.start(Main.java:15)
    at com.sun.javafx.application.LauncherImpl.lambda$launchApplication13(LauncherImpl.java:821)
    at com.sun.javafx.application.LauncherImpl$$Lambda/1616271442.run(Unknown Source)
    at com.sun.javafx.application.PlatformImpl.lambda$runAndWait6(PlatformImpl.java:323)
    at com.sun.javafx.application.PlatformImpl$$Lambda/1051754451.run(Unknown Source)
    at com.sun.javafx.application.PlatformImpl.lambda$null4(PlatformImpl.java:292)
    at com.sun.javafx.application.PlatformImpl$$Lambda/1139233777.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at com.sun.javafx.application.PlatformImpl.lambda$runLater5(PlatformImpl.java:291)
    at com.sun.javafx.application.PlatformImpl$$Lambda/1775282465.run(Unknown Source)
    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$null1(WinApplication.java:102)
    at com.sun.glass.ui.win.WinApplication$$Lambda/1109371569.run(Unknown Source)
    at java.lang.Thread.run(Thread.java:745)

可疑的是,当我尝试将 FXML 文件移动到 eclipse 中的不同包时,我收到此消息对话框错误: 发生内部错误:"Search progress polling"。 线程访问无效

FXML 在找不到您要加载的 FXML 文档时抛出该错误。

查看屏幕截图,这看起来应该可以帮助您解决遇到的错误:

Parent root = 
FXMLLoader.load(getClass().getResource("/com/root/tomaszm/MainRoot.fxml"));