openjfx / samples

JavaFX samples to run with different options and build tools
BSD 3-Clause "New" or "Revised" License
589 stars 1.52k forks source link

FMXLoader Caused Error During run the project #48

Closed AlperGuven closed 4 years ago

AlperGuven commented 4 years ago

I compile project with Maven compiler:compile, after that i want to run project with javafx:run. Then error comes up: Caused by: java.lang.IllegalStateException: Location is not set. at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2459)

I do not know why but project didn't see the ".fxml" files.

arjunpola commented 4 years ago

I get the same error when trying to run the modular project with Intellij IDE.

The issue seems to be that getClass().getResource("scene.fxml") in MainApp.java return null

AlperGuven commented 4 years ago

Now I see the problem, I think. When I compile with Javafx library (javafx:compile), its compile properly, and run with again javafx library (javafx:run) application is run without problem. I guess, Maven compiler did not recognize some feature of javafx or problem with getResource function path variable. So, i did not understand the situtation but now FMXLoader is runnig without problem.