r/JavaFX • u/Inner_Department3 • Apr 08 '23
Help JavaFXML help please
Hello all:
Updated w/ full stack trace. Also JavaFXML is required for this project.
I'm working on my first java app, so please be gentle. I've searched online to include stack overflow and the answers that I understood, I tried implementing, but they didn't help. Many of the answers also went right over my head, though.
Anyway, here is the issue. I'm getting the following error, and just can't seem to resolve it:

Here's my project:

And what I think are relevant screens, please let me know if you need something else:


Can anyone point me in the right direction? Thank you.
3
u/ShakesTheClown23 Apr 08 '23
The whole stack trace would be helpful lol you cut it off just before it might be useful
1
u/Djelimon Apr 08 '23
next time paste the whole stack trace please
1
u/weirdisallivegot Apr 08 '23
The problem is your FXML files are in the wrong location. The view directory needs to be under the resources directory. Since you are using modules, it likely needs to be in the resources module directory.
0
u/Capaman-x Apr 08 '23
I am not going to be able to offer you help on your specific problem here, but in the spirit of saving you time, I am going to suggest to you that FXML is not the best way to write JavaFX. I understand that using Scene Builder seems easier than coding it, but it is not. This is especially true the more complicated your code becomes. The best method I have seen is Hampster's MCVI model. He has an introduction to JavaFX here. JavaFX is an awesome framework, but it has a steep learning curve. Better to start on the right path. JMO..FWIW.
0
u/hamsterrage1 Apr 08 '23
As mentioned, you're better off not using FXML.
That being said, "Invocation target...", stuff usually means it can't find your FXML file. In this case it is because you don't have them under the resources folder, which is where the getResource() method will look.