0

Whenever I try to run my JavaFX jar program in the command line, I get the error: Error: JavaFX runtime components are missing, and are required to run this application I used JavaFX 17, the Zulu JDK FX 17, and NetBeans 17 to build the project. I used the instructions on openjfx.org to create the project using Ant. I tried using Maven first, and followed the instructions, but I couldn't get it to work, so please don't just say "use Maven." In the lib folder, it seems to have everything it needs to run. Below is a picture: lib directory that contains javafx.base.jar, javafx.controls.jar, javafx.fxml.jar, javafx.graphics.jar, javafx.media.jar, javafx.swing.jar, javafx.web.jar, javafx-swt.jar, and jrt-fs.jar.

I made sure that the JAVA_HOME environment variable is set to C:\Program Files\Java\zulu17.40.19-ca-fx-jdk17.0.6-win_x64 which is where I put the Zulu JDK. Is there something else I'm missing here? Is there another environment variable I need to set? Or is there a library I'm missing?

Choosechee
  • 73
  • 7
  • 2
    The OpenJFX instructions refer to [OpenJDK](https://openjfx.io/openjfx-docs/#install-java), not Zulu JDK FX, which a different distribution. Though Zulu JDK FX can be used, and is a good option, OpenJFX instructions don't document how to do that. Because JDK FX includes JavaFX, you don't need to include JavaFX modules in your distribution, just have the client install JDK FX and they will be able to use your application without having to specify any JavaFX modules. You still need to make other 3rd party dependencies available in your distribution if you have them. – jewelsea Jul 13 '23 at 22:21
  • 2
    *"Is there something else I'm missing here?"* -> yes. As noted by the error message you see `JavaFX runtime components are missing, and are required to run this application`. The runtime components are the native code (e.g. native `.dll` or `.so` files) that JavaFX requires to run and differ depending on the target architecture and system. – jewelsea Jul 13 '23 at 22:27
  • 1
    Runtime components are included in classified Maven artifacts (jars) in the Maven central library. Runtime components are also included in `jmod` files downloadable from Gluon. The JavaFX SDK also includes runtime components but they are separate native library files like `.dll` or `.so` files, and are not in the jar files bundled with the SDK, so if you just include the jar files bundled with the SDK with your distribution without some way to access the correct native code for the target platform, it will be broken because the "JavaFX runtime components are missing". – jewelsea Jul 13 '23 at 22:30
  • 1
    Exactly which instructions sections from openjfx.io are you following? It should be something in the ["Runtime Images"](https://openjfx.io/openjfx-docs/#modular) section if you want to run something outside of the IDE. Because JDK FX includes JavaFX, its function and usage are similar to that in the "Custom JDK+JavaFX image" section of the OpenJFX documentation, only you don't need to actually build the custom JRE, because Zulu JRE FX can supply a prebuilt one for you to download. – jewelsea Jul 13 '23 at 22:33

0 Answers0