0

I'm running jdk 1.8_191

I created an JavaFX application.

I tested it in IDE, everything runs well.

I created an exe Artifact, I get errors when loading FXML's.

Solved it tho by putting my FXML files and Java files in one folder like this FXML Files and Java Files in one folder

used to put FXML files in that empty view folder and run my code like this Like this

but I get errors only in generated exe Artifact. Runs smoothly in IDE (IntelliJ).

My question is why? I'd like to separate my FXML files and JAVA files for neatness and better readability. Why does it only work if both files are in the same folder in Artifact, but works separated in IDE? is this just the way it should be?

P.S. I've also read that I must place my FXML under "resources" folder but it didn't work as well (in Artifact). What am I missing? thanks!

Community
  • 1
  • 1
Karl Garcia
  • 45
  • 11
  • Java is not intended to be packaged in a exe; best of luck with that! – Elliott Frisch Dec 15 '18 at 20:34
  • @ElliottFrisch The funny thing is, the exe Artifact that I created works well than the Jar file. I created both but the Jar file generates an "Exception in thread JavaFX Application Thread java.lang.RuntimeException" Error. – Karl Garcia Dec 15 '18 at 20:40
  • 1
    There is plenty of information missing. How do you create the exe file? How does your classpath in IntelliJ look like? Where did you put the fxml file before? – dpr Dec 15 '18 at 20:51
  • @dpr Built an artifact following this tut [link](https://stackoverflow.com/questions/1082580/how-to-build-jars-from-intellij-properly/4901370) What do you mean by how does my class path look like? I tried under main/view/.fxml, main/resources/view/.fxml main/java/view/.fxml. but only works (as an Artifact) if placed in the same folder with the Controller java class. Thanks! – Karl Garcia Dec 16 '18 at 13:31
  • And how do you create an exe from the jar file? – dpr Dec 16 '18 at 15:30
  • @dpr don't have to. IntelliJ lets me build an exe artifact. (https://www.youtube.com/watch?v=_KHCHiH2RZ0) – Karl Garcia Dec 16 '18 at 16:20

0 Answers0