Issue
I am trying to run JavaFX application but there is showing the following error
Error: JavaFX runtime components are missing, and are required to run this application
Until this step, I could not import the JavaFX, and I have done it from /usr/lib/jvm/java-8-openjdk-amd64
Can someone help to solve this error?
Thanks beforehand. By the way, I am using lubuntu operating system
Solution
As explained on official OpenJFX website
- open your intellij idea IDE and create new Project
- Go to File > Project Structure
- Go to Project Settings > Libraries
- Click on + button
- Locate ..\openjfx-11.0.1_windows-x64_bin-sdk\javafx-sdk-11.0.1\lib folder from extracted zip of openJFX 11
- Apply settings and click ok
- Go to File > Settings
- In Settings go to Appearance & Behavior > System Settings > Path Variables
- Click on + and add new path variable name it PATH_TO_FX and in value field locate ..\openjfx-11.0.1_windows-x64_bin-sdk\javafx-sdk-11.0.1\lib folder
- Apply settings and click ok
- The go to Run > Edit Configurations
- Select your Application from Application > {your application name}
- Then click on Configuration tab and in VM options field write this: --module-path ${PATH_TO_FX} --add-modules=javafx.controls,javafx.fxml
- Then Click on Edit templates button select Application in Templates and again in VM options field write this: --module-path ${PATH_TO_FX} --add-modules=javafx.controls,javafx.fxml
- Apply settings and click ok and now you are good to go
- You have to do this whenever you create new project in intellij
Answered By - user10485339