Reputation: 33
I try to launch my project in Eclipse from the main class and I get the error : JavaFX runtime components are missing, and are required to run this application
I've used the solution described here: https://edencoding.com/runtime-components-error/
where I changed the VM Arguments in my Run Configurations by adding:
--module-path C:\Users\jente\OneDrive\Documenten\javafx-sdk-15.0.1\lib--add-modules=javafx.controls
However, after applying I still get the runtime error. Any help?
Upvotes: 0
Views: 1478
Reputation: 994
The best way to avoid this issue is to simply use a custom Java that includes JFX. I recommend the Azul packages.
https://www.azul.com/downloads/zulu-community/?version=java-15-mts&package=jdk-fx
Upvotes: 1
Reputation: 41
It's my first post so HelloWorld first.
I had similar problem with intellij and I tried to adapt this solution to Eclipse. I think it worked so you can try this:
First of all as it was mentioned in previous
solution you tried, add this to your VMarguments:
--module-path "/YourPath/javafx-sdk-15.0.1/lib" --add-modules=javafx.controls,javafx.fxml
(in my case quotation marks were crucial)
then be sure that you added a library: right click on your project folder --> properties-->Java build path --> click on "module path" --> add library --> user library --> users libraries... --> new --> type for example javaFx15 --> Add external Jars... --> select all jar in javaFx lib folder, click open and apply and close.
If it's not working yet then try to add module-info.java by: right click on your project folder --> configure --> create module-info.java
the body should look like this:
module YourModuleName {
requires javafx.base;
requires javafx.graphics;
requires javafx.fxml;
requires javafx.controls;
opens YourFxmlFile;
}
It worked for me. I hope it'll work you too.
Upvotes: 2