0

Trying to open .JAR file on macOS Ventura intel base laptop running java 8 351. GUI game was built using IntelliJ, Java jdk 19 and JavaFX 19. Getting a console error message with no console appearing. GUI game works perfectly inside IntelliJ, included right libraries and module paths. When building artifacts "exporting jar executable" I get prompted with this error message whenever I'm trying to open it.Error Message

Solutions tried to find where the problem is with no avail

  1. I tried creating simple javafx program and building artifacts.
  2. Built project with different java jdks.
  3. Built project with visual studio code and eclipse.
  4. Went through the same steps on a older macOS

I'm suspecting its a java jre error, any tips on how to fix this problem?

mkawa025
  • 1
  • 1
  • 1
    Programs built with later JDKs won't run on older ones, by default. Run your program from the command line and you'll get better error messages, or look in if the OS X Console log. Did you try building with JDK 8? – tgdavies Dec 27 '22 at 01:52
  • As @tgdavies notes, and for JavaFX in particular, "it is required to have a recent version of JDK 19, or at least JDK 11.", as noted in the [getting started documentation](https://openjfx.io/openjfx-docs/). Usually, the best way to ensure that is to package your app with the JDK and JavaFX modules using a tool like `jlink` or `jpackage` (see the packaging topic in the [JavaFX tag](https://stackoverflow.com/tags/javafx/info)), unfortunately it is not a straight-forward topic. – jewelsea Dec 27 '22 at 06:47

1 Answers1

-2

You Should Make FXML files in one package and go to project structure -> Modules -> sources. Then select your package of fxml files and mark it as resource.

Pic Of Example Mark Module As Resource

Then Re Arrange getClass().getResourse("") code lines using under scenario

Pic Of Example Direction to resources

The "./" Directly direct into resources.

Jar files cannot read fxml files until you make them as resources

  • 1
    The question doesn't even mention FXML. – jewelsea Dec 27 '22 at 06:43
  • As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Dec 28 '22 at 09:32
  • I'm not using FXML files, project was built without it. All right files are included in modules. – mkawa025 Dec 31 '22 at 04:39