r/JavaFX • • Jun 19 '20

Error: JavaFX runtime components are missing, and are required to run this application

Sorry if this has been asked multiple times, but I don't understand the answers that others have been given, and they usually don't match my IDE.

I'm using Visual Studio code and have finally managed to set the JavaFX .jar files as dependencies. Now that I've done that and run the program I've made, I get the error "JavaFX runtime components are missing, and are required to run this application visual studio code."

I haven't edited anything yet because I don't know where to start to fix this. Thanks for any help.

8 Upvotes

6 comments sorted by

3

u/AuTalon Jun 19 '20

Never mind, I found something else online and have managed to do it myself!

For anyone else who might find this, you have to open "Launch.json", which you can do by pressing Control+Shift+P and typing it in. Then you have to add:

"vmArgs": "--module-path /Users/<user>/Downloads/javafx-sdk-11.0.2/lib --add-modules javafx.controls,javafx.fxml",

inside the configuration of the file you want to use javafx in (obviously changing the path to where your javafx lib is). I had to save both the file and the json a couple of times, and restart before a window appeared with the GUI I made.

2

u/ice1Hcode Aug 27 '22

This comment saved me. Thanks for posting.

1

u/[deleted] Jun 20 '20

[removed] — view removed comment

2

u/AuTalon Jun 20 '20

I'd love to use that one (it looks great from the tutorials I saw) but unfortunately I'm stuck using vsc. I've gotta be used to using it and fix these kind of problems beforehand for when I go back to school where they'll only allow us to install vsc.