Caused by: java.lang.IllegalAccessError: class com.sun.javafx.fxml.FXMLLoaderHelper (in unnamed module @0x6a15cd04) cannot access class com.sun.javafx.util.Utils (in module javafx.graphics) because module javafx.graphics does not export com.sun.javafx.util to unnamed module @0x6a15cd04
All things are lawful, but not all things are profitable.
Stephan van Hulst
Saloon Keeper
Posts: 10858
234
posted 1 week ago
Knute, -p is a shorthand for the module path.
It seems that IntelliJ just doesn't deal well with mixed classpath/module projects.
You might want to make your project into a full blown module by adding a module-info.java to the root package and declare that your project requires javafx.controls, javafx.fxml and javafx.graphics.
You might also have to open your module to some JavaFX modules, but your compiler will tell you which ones.
Stephan van Hulst wrote:Knute, -p is a shorthand for the module path.
Thanks for clearing that up.
I still don't think the vm args are set correctly. I tried (in Eclipse) to only use the base and graphics modules and I got a runtime error executing the code. I think you need the controls module, like this:
Or even more simply:
All things are lawful, but not all things are profitable.
Stephan van Hulst
Saloon Keeper
Posts: 10858
234
posted 6 days ago
For an FXML application you also need to add the javafx.fxml module to the root nodes of the module graph. It just appears that IntelliJ either doesn't understand what modules to add to the graph, or the OP didn't add the module like they said they did.
Exception in thread "main" java.lang.Error: Unresolved compilation problem:
The method launch(String[]) is undefined for the type Main
at DBFX2020.Main.main(Main.java:25)
Stephan van Hulst
Saloon Keeper
Posts: 10858
234
posted 6 days ago
You're missing a dependency on javafx.graphics.
Honestly, you can save yourself a lot of pain if you just use Maven. All you need to do is declare a dependency on javafx.controls and javafx.fxml and you're good to go. To run the application, use the javafx:run Maven goal.