[英]Can Not Start MvvmFX java.io.IOException: Error loading FXML - can't load from given resourcepath
I am tyring to use mvvmFX ( git link ) on Maven JavaFX project我很想在 Maven JavaFX 项目上使用 mvvmFX ( git link )
It's just a very simple project to load an fxml file using de.saxsys.mvvmfx.FluentViewLoader使用de.saxsys.mvvmfx.FluentViewLoader加载fxml文件只是一个非常简单的项目
This is the sample project link (git) Sample Program这是示例项目链接(git)示例程序
I am using :我在用 :
App.java应用程序.java
FluentViewLoader.FxmlViewStep fvs = FluentViewLoader.fxmlView( SecondView.class );
ViewTuple vt = fvs.load();
Parent parent = vt.getView();
// Scene scene = new Scene(FluentViewLoader.fxmlView(SecondView.class).load().getView());
Scene scene = new Scene( parent );
stage.setScene(scene);
stage.show();
But i keep getting these error但我不断收到这些错误
Caused by: java.io.IOException: Error loading FXML - can't load from given resourcepath: /com/wiljos/SecondView.fxml
at de.saxsys.mvvmfx@1.9.0-20191021.143511-11/de.saxsys.mvvmfx.internal.viewloader.FxmlViewLoader.createFxmlLoader(FxmlViewLoader.java:285)
at de.saxsys.mvvmfx@1.9.0-20191021.143511-11/de.saxsys.mvvmfx.internal.viewloader.FxmlViewLoader.loadFxmlViewTuple(FxmlViewLoader.java:214)
Seems like the problem is, it can not find the fxml file.似乎问题是,它找不到 fxml 文件。 Can anyone help me solving this?谁能帮我解决这个问题?
I compiled and ran the project.我编译并运行了这个项目。 Just open your fxml directory to module mvvmfx like:只需打开你的 fxml 目录到模块 mvvmfx 像:
opens com.wiljos to de.saxsys.mvvmfx,javafx.fxml;
Now the fxml file can be accessed correctly by mvvmfx.现在可以通过 mvvmfx 正确访问 fxml 文件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.