[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)


Questions with java tag:

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 getting " (1) no such column: _id10 " error Instantiating a generic type When to create variables (memory management) java doesn't run if structure inside of onclick listener String method cannot be found in a main class method Are all Spring Framework Java Configuration injection examples buggy? Calling another method java GUI I need to know how to get my program to output the word i typed in and also the new rearranged word using a 2D array Java and unlimited decimal places? Read input from a JOptionPane.showInputDialog box Cannot retrieve string(s) from preferences (settings) strange error in my Animation Drawable Two Page Login with Spring Security 3.2.x Hadoop MapReduce: Strange Result when Storing Previous Value in Memory in a Reduce Class (Java) Got a NumberFormatException while trying to parse a text file for objects Best way for storing Java application name and version properties Call japplet from jframe FragmentActivity to Fragment Comparing two joda DateTime instances Maven dependencies are failing with a 501 error 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) Why am I getting Unknown error in line 1 of pom.xml? Gradle: Could not determine java version from '11.0.2' Error: Java: invalid target release: 11 - IntelliJ IDEA Android Gradle 5.0 Update:Cause: org.jetbrains.plugins.gradle.tooling.util Why is 2 * (i * i) faster than 2 * i * i in Java? must declare a named package eclipse because this compilation unit is associated to the named module How do I install Java on Mac OSX allowing version switching? How to install JDK 11 under Ubuntu? Java 11 package javax.xml.bind does not exist IntelliJ can't recognize JavaFX 11 with OpenJDK 11 Difference between OpenJDK and Adoptium/AdoptOpenJDK OpenJDK8 for windows How to allow all Network connection types HTTP and HTTPS in Android (9) Pie? Find the smallest positive integer that does not occur in a given sequence Error: JavaFX runtime components are missing, and are required to run this application with JDK 11 How to uninstall Eclipse? Failed to resolve: com.google.firebase:firebase-core:16.0.1 How to resolve Unable to load authentication plugin 'caching_sha2_password' issue

Questions with intellij-idea tag:

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 Gradle - Could not target platform: 'Java SE 8' using tool chain: 'JDK 7 (1.7)' JAVA_HOME should point to a JDK not a JRE Class JavaLaunchHelper is implemented in two places How do I activate a Spring Boot profile when running from IntelliJ? Class Not Found: Empty Test Suite in IntelliJ System.out.println() shortcut on Intellij IDEA Can't push to the heroku Error: Module not specified (IntelliJ IDEA) IntelliJ cannot find any declarations Re-run Spring Boot Configuration Annotation Processor to update generated metadata Kotlin unresolved reference in IntelliJ Android Gradle Apache HttpClient does not exist? Intellij Idea: Importing Gradle project - getting JAVA_HOME not defined yet Any way (or shortcut) to auto import the classes in IntelliJ IDEA like in Eclipse? Intellij JAVA_HOME variable Unable to run Java code with Intellij IDEA What are .iml files in Android Studio? How to: Install Plugin in Android Studio Where to put the gradle.properties file Error: Unfortunately you can't have non-Gradle Java modules and > Android-Gradle modules in one project How to install Intellij IDEA on Ubuntu? Error:java: javacTask: source release 8 requires target release 1.8 How to delete projects in Intellij IDEA 14? Android studio Error "Unsupported Modules Detected: Compilation is not supported for following modules" How to decompile to java files intellij idea Class file has wrong version 52.0, should be 50.0 Change remote repository credentials (authentication) on Intellij IDEA 14 Git Stash vs Shelve in IntelliJ IDEA Getting Gradle dependencies in IntelliJ IDEA using Gradle build git with IntelliJ IDEA: Could not read from remote repository Could not install Gradle distribution from 'https://services.gradle.org/distributions/gradle-2.1-all.zip' cannot resolve symbol javafx.application in IntelliJ Idea IDE Intellij Cannot resolve symbol on import intellij incorrectly saying no beans of type found for autowired repository Best way to add Gradle support to IntelliJ Project How do I remove my IntelliJ license in 2019.3? How can I analyze a heap dump in IntelliJ? (memory leak) Package name does not correspond to the file path - IntelliJ Unable to open debugger port in IntelliJ IDEA .ssh/config file for windows (git)

Questions with javafx tag:

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 Is it possible to run JavaFX applications on iOS, Android or Windows Phone 8? Maven won't run my Project : Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:exec JavaFX and OpenJDK JavaFX Location is not set error message Swing vs JavaFx for desktop applications Passing Parameters JavaFX FXML Platform.runLater and Task in JavaFX close fxml window by code, javafx JavaFX: How to get stage from controller during initialization? How to close a JavaFX application on window close? JavaFX 2.1 TableView refresh items JavaFX - create custom button with image JavaFX Application Icon JavaFX How to set scene background image What is the recommended way to make a numeric TextField in JavaFX?

Questions with openjfx tag:

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