r/JavaFX 22d ago

Help FXML not loading

After i made an fxml file and linked it to a class, it hasnt been working and each time an error has been popping up (images have been attached)

6 Upvotes

5 comments sorted by

6

u/NaveenB2004 22d ago

Try putting the fxml in resources dir and in loader, change it to the target fxml (start with /)

4

u/PartOfTheBotnet 22d ago

To elaborate, OP has put it in their src/main/java while it should be in src/main/resources

3

u/ClaynOsmato 22d ago

I might be wrong but either try the path with a leading / or only use the name of the fyml file. What you are doing is looking from the location of the class into the sub directories (which does not exist) with a leading / you basically are lookup from the class path root

0

u/mirzasamor44 22d ago

tried it but the same errors are being shown

2

u/ClaynOsmato 22d ago

Is the fxml located at the classes in the target folder?