2

I'm currently working on a university assignment which requires me to create an application using Java. I'm using IntelliJ IDEA to create this JavaFX application.

I can build and run the application from IntelliJ directly - I've used tutorials such as this to help me do so. This allows the application to run perfectly.

However, upon building the JAR file, the application won't load, and throws the following error:

Error: JavaFX runtime components are missing, and are required to run this application

I can't seem to understand why this would be the case but hoping someone here might know. I've looked around for similar questions - I haven't found one where the error is ONLY when running the JAR file.

I'm using OpenJDK 11 and OpenJFX 11.

Any help provided is much appreciated.

5
  • There are many questions on Stack Overflow with “JavaFX runtime components are missing” in them. Commented May 16, 2020 at 19:57
  • Correct, each of which talk about the fact they cannot use it within IntelliJ, whereas I can. I can’t use it within a JAR. Commented May 16, 2020 at 20:07
  • Because JavaFX is not part of Java as of 11, so JavaFX is neither in the Java runtime nor in your .jar file. Commented May 16, 2020 at 20:09
  • @VGR, I understand that, however, clearly, what I've done so far works for running the application within IntelliJ - this means that it's looking in the right places to run the application. But, when compiled into a .jar, it doesn't work. I've copied the JavaFX .jar files into the Articfacts output layout, yet that doesn't work. Commented May 16, 2020 at 21:29
  • I expect IntelliJ is doing what those posts state: adding JavaFX to the module path. When you run your jar file without any additional module path or classpath settings, you are not doing the same thing IntelliJ is doing. Commented May 16, 2020 at 22:23

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.