avatarTech Notes

Summary

This context provides a step-by-step guide to resolve the "JavaFX runtime components are missing" error in IntelliJ IDEA by JetBrains.

Abstract

The guide begins by specifying the author's system specs and then proceeds to instruct users on downloading the JavaFX SDK and jar files. The guide then walks users through adding the lib folder containing the JavaFX .jar files to their IntelliJ project. Afterward, the guide advises users to ensure that their VM options are correctly pointed to the JavaFX library. The guide also includes a section on adding a PATH_TO_FX convenience variable to simplify the process of specifying the JavaFX library path.

Opinions

  • The author expresses frustration with the difficulty of finding older JavaFX versions, noting that the message indicating how to include older versions is small-ish.
  • The author suggests copying the JavaFX SDK files into the Java folder for better organization.
  • The author notes that typing out the VM options instead of copy-pasting them into the VM Options field may prevent issues with IntelliJ.
  • The author recommends joining Medium and subscribing to their service for AI-related content.
  • The author suggests using ZAI.chat as a cost-effective alternative to ChatGPT Plus (GPT-4).
  • The author mentions that they have had serious issues with IntelliJ if they copy and paste into VM Options, even when pasting from a developer-friendly text editor.
  • The author states that adding the PATH_TO_FX convenience variable can simplify the process of specifying the JavaFX library path.

[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: 16
Kotlin: 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- folder where you have stored all your JavaFX .jar files you should have gotten when you installed the 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.graphics

Into 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.

Intellij
Javafx
Runtime Components
Missing
Required
Recommended from ReadMedium