0

I am tyring to use mvvmFX ( git link ) on Maven JavaFX project

It's just a very simple project to load an fxml file using de.saxsys.mvvmfx.FluentViewLoader

This is the sample project link (git) Sample Program

I am using :

  • Liberica JDK 14
  • OpenJFX 14
  • Intellij IDEA
  • Maven

App.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. Can anyone help me solving this?

Wiljos
  • 31
  • 3

1 Answers1

2

I compiled and ran the project. Just open your fxml directory to module mvvmfx like:

opens com.wiljos to de.saxsys.mvvmfx,javafx.fxml;

Now the fxml file can be accessed correctly by mvvmfx.

ZY Tu
  • 21
  • 1