javaintellij-ideajavafx

Can't run JavafX Jar file Error: JavaFX runtime components are missing, and are required to run this application


So I'm trying to build an artifact of my JavaFX program using IntelliJ Idea, but when I try to run the jar file I keep getting Error: JavaFX runtime components are missing, and are required to run this application

Artifacts: enter image description here

Libraries: enter image description here

Modules: enter image description here

Project: enter image description here

Main file run configuration: enter image description here

Not sure what I'm missing here.


Solution

  • See the Idea documentation on JavaFX artifacts, it says:

    Packaging a JavaFX application in .jar is possible only with Java 8. For Java 11 and later, use the jlink tool to package your application.

    The troubleshooting section says:

    If you're using a JDK build of version 9 and later, use third-party solutions for packaging. For example, refer to section Runtime images in the JavaFX official documentation. You can find more options for packaging on Stack Overflow.

    The packaging info from StackOverflow is in the JavaFX tag wiki, section "Packaging".