[java] Error: JavaFX runtime components are missing, and are required to run this application with JDK 11

I'm trying to run the sample JavaFX project using IntelliJ but it fails with the exception :

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

I have downloaded JDK 11 here : http://jdk.java.net/11/ I have downloaded OpenJFX here : http://jdk.java.net/openjfx/ I'm using : IntelliJ IDEA 2018.2 (Community Edition) Build #IC-182.3684.40, built on July 17, 2018 JRE: 1.8.0_152-release-1248-b8 amd64 JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o Windows 10 10.0

I have created a new JavaFX project in IntelliJ using JDK 11. My JavaFX classes were not known so I have added the OpenJFX library by doing :

  • File -> Project Structure -> Modules -> + -> Library -> Java

I have the OpenJFX added with the 8 jars below "classes" and also the folders below "Sources" and the path to the bin folder under "Native Library Locations".

When I'm building the project, it's good, but impossible to run it.

What am I doing wrong?

This question is related to java intellij-idea javafx openjfx

The answer is


This worked for me:

File >> Project Structure >> Modules >> Dependency >> + (on left-side of window)

clicking the "+" sign will let you designate the directory where you have unpacked JavaFX's "lib" folder.

Scope is Compile (which is the default.) You can then edit this to call it JavaFX by double-clicking on the line.

then in:

Run >> Edit Configurations

Add this line to VM Options:

--module-path /path/to/JavaFX/lib --add-modules=javafx.controls

(oh and don't forget to set the SDK)


Examples related to java

Under what circumstances can I call findViewById with an Options Menu / Action Bar item? How much should a function trust another function How to implement a simple scenario the OO way Two constructors How do I get some variable from another class in Java? this in equals method How to split a string in two and store it in a field How to do perspective fixing? String index out of range: 4 My eclipse won't open, i download the bundle pack it keeps saying error log

Examples related to intellij-idea

IntelliJ: Error:java: error: release version 5 not supported Has been compiled by a more recent version of the Java Runtime (class file version 57.0) Error: Java: invalid target release: 11 - IntelliJ IDEA IntelliJ can't recognize JavaFX 11 with OpenJDK 11 Error: JavaFX runtime components are missing, and are required to run this application with JDK 11 ERROR Source option 1.5 is no longer supported. Use 1.6 or later Cannot inline bytecode built with JVM target 1.8 into bytecode that is being built with JVM target 1.6 How to configure "Shorten command line" method for whole project in IntelliJ intellij idea - Error: java: invalid source release 1.9 Failed to resolve: com.google.android.gms:play-services in IntelliJ Idea with gradle

Examples related to javafx

IntelliJ can't recognize JavaFX 11 with OpenJDK 11 Error: JavaFX runtime components are missing, and are required to run this application with JDK 11 JavaFX FXML controller - constructor vs initialize method Why is JavaFX is not included in OpenJDK 8 on Ubuntu Wily (15.10)? cannot resolve symbol javafx.application in IntelliJ Idea IDE javac: invalid target release: 1.8 How to change the color of text in javafx TextField? Issue with background color in JavaFX 8 What's the location of the JavaFX runtime JAR file, jfxrt.jar, on Linux? How to create a popup windows in javafx

Examples related to openjfx

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