Reputation: 1552
I have a JavaFX project which runs this way:
FXMLLoader loader = new FXMLLoader(getClass().getResource("Login.fxml"));
My folder scheme is like this:
It works great in Eclipse but when I export it into a Runnable JAR and execute it from the console, it does:
I put in the jar folder my Login.fxml
different ways:
resources
application
inside resources
But none of this is working. Where I am supposed to place my Login.fxml
file?
I would appreciate some help here. Thank you.
Upvotes: 0
Views: 481
Reputation: 21
I noticed that non-java files have landed within src
directory inside the jar, so I simply added src/
before fxml file path. Not the best solution but it allows to generate working runnable jar file.
Upvotes: 0
Reputation: 1552
I got it:
My Login.fxml
class was inside the application
package.
So i created a application folder inside the folder in wich the jar file is:
And inside application folder I peasted the Login.fxml
file.
I also created res
and src
for other resources.
Upvotes: 1