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 :
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 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.
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)