IntelliJ IDEA – Error: JavaFX runtime components are missing, and are required to run this application [duplicate]

There are similar questions like this or this other one.

Before JavaFX 11, whenever you were calling something JavaFX related, you had all the javafx modules available within the SDK.

But now you have to include the modules/dependencies you need.

Your error says that you are using FXML but it can’t be resolved, but you have just added the javafx.controls module:

--add-modules=javafx.controls

As you can see in the JavaDoc the javafx.controls module depends on javafx.graphics and java.base, but none of those modules includes the FXML classes.

If you need FXML classes like the FXMLLoader, you need to include javafx.fxml module:

 --module-path="C:\Program Files\Java\javafx-sdk-11\lib" \
    --add-modules=javafx.controls,javafx.fxml

The same will apply if you need media or webkit, those have their own modules.

Leave a Comment