[Solved] Error: JavaFX runtime components are missing, and are required to run this application in IntelliJ by JetBrains.
If you’re seeing this project, you’re probably missing your JavaFX libraries and you need to add them to you IDE. I saw this error in IntelliJ by JetBrains and this tutorial shows how to fix that error in IntelliJ.
My Specs
For IntelliJ IDEA 2022.1 (Community Edition) on Windows 10/11
IntelliJ IDEA 2022.1 (Community Edition)
Build #IC-221.5080.210, built on April 11, 2022
Runtime version: 11.0.14.1+1-b2043.25 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Windows 11 10.0
GC: G1 Young Generation, G1 Old Generation
Memory: 1972M
Cores: 16Kotlin: 221-1.6.20-release-285-IJ5080.210
My specs:

If you don’t have JavaFX SDK and jar files already, let’s go get them.
Go to the Java FX SDK Downloads page [1].

If you want an older version than the latest version, check the “Include older versions” checkbox. (it was actually hard for me to figure this out lol, the message telling you to do this is a bit small-ish)
Unzip the folder into
C:\Program Files\Java
jfx sdk folder highlighted in blue
It should look like this inside your folder:

All your libs are these .jar files, you are going to add this lib folder into your IntelliJ project.


File -> Project Structure
Hit the + button

Navigate to the folder lib folder inside of your javafx-sdk-
Mine look like this. I have chosen to copy them into my Java folder in Program Files so that all my Java stuff is in one place,

Make sure you select the “lib” folder
It’ll look like this if you’ve selected correctly

In the Project Explorer on the left side panel it should look like this when you expand External Libraries

There should be a lib folder which when expanded should show you all your jar files
You can see all my red text has disappeared too, so we’re all good to go.
Note: you may need to make sure your VM options are pointed to your JavaFX library as well,
PATH_TO_FX Convenience Variable
Add a path variable by going to File -> Settings -> Appearance and Behavior -> Path Variables

and click the + button

to add a new variable you will call “PATH_TO_FX”

Set its value to be the path to the lib folder inside of your JavaFX module you downloaded from the internet,
This is what mine looks like:

You don’t have to be on the same version as me, here is a screencap from another project with I link to JFX version 18

C:\Program Files\Java\javafx-sdk-18.0.1\lib
VM Options
Next: go to the Main Selector dropdown on the top right hand side near the Build and Run buttons and select “Edit Configurations …”

Click “Modify Options”

Select “Add VM Options”

And add this line:
--module-path ${PATH_TO_FX} --add-modules javafx.fxml,javafx.controls,javafx.graphicsInto the option labelled “VM Options”

I have had serious issues with IntelliJ if I copy and paste into VM Options, even pasting from Sublime Text which is an editor for developers, nothing crazy like Microsoft Word or something, and had issues so I STRONGLY recommend that you actually type that line out instead of copy-pasting it in to VM Options

See VM options (the second item in the form)
If you haven’t joined Medium but would love to, click here. By signing up for Medium through my referral link, I will receive a small commission.






