javafx fxml file not found
i get an error saying that
getClass().getResource("LoginAdminView.fxml")
at line 22 is null
i dont understand why since i have the same setup in the main class and that works. the only difference is that this class is in a subfolder and the main isnt. But i can't figure out what's wrong16 Replies
⌛
This post has been reserved for your question.
Hey @asdru! Please useTIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here./close
or theClose Post
button above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.
Unknown User•10mo ago
Message Not Public
Sign In & Join Server To View
💤
Post marked as dormant
This post has been inactive for over 300 minutes, thus, it has been archived.
If your question was not answered yet, feel free to re-open this post or create a new one.
In case your post is not getting any attention, you can try to use /help ping
.
Warning: abusing this will result in moderative actions taken against you.
i dont understand why
main.java
can find it but controller/homecontroller.java
cant💤
Post marked as dormant
This post has been inactive for over 300 minutes, thus, it has been archived.
If your question was not answered yet, feel free to re-open this post or create a new one.
In case your post is not getting any attention, you can try to use /help ping
.
Warning: abusing this will result in moderative actions taken against you.
💤
Post marked as dormant
This post has been inactive for over 300 minutes, thus, it has been archived.
If your question was not answered yet, feel free to re-open this post or create a new one.
In case your post is not getting any attention, you can try to use /help ping
.
Warning: abusing this will result in moderative actions taken against you.
.
you named the folder
gioco.progettospacc...
it should be a folder named guico
with a folder progettospacc...
in itAre you sure? Cause the file is found if i put the getResource in the main
Oh wait they already are 2 folders
intellij just uses a . instad of the /
inside src/main/java, yes
inside src/main/resources, no
at least when I last used IntelliJ
ok
it needs to be in the controller package/directory
ah so resources/gioco/progettospacca/controller?
since you are using
getClass().getResource("LoginAdminView.fxml")
which requires it to be in the same directory
yes
or you change it to getClass().getClassLoader().getResource("gioco/progettospacca/controller/LoginAdminView.fxml")
yes it works!!
thank you so much
If you are finished with your post, please close it.
If you are not, please ignore this message.
Note that you will not be able to send further messages here after this post have been closed but you will be able to create new posts.
Post Closed
This post has been closed by <@372715536121069578>.