Issue
I'm new to Javafx and I was wondering why i get the error below, whenever I run JavaFX code in Visual Studio Code.
Error: JavaFX runtime components are missing, and are required to run this application
When i run it on cmd, it works perfectly fine (The window pops up, I put in data and the game starts).
This is what I enter in CMD: to Compile the code:
javac --module-path "C:\Desktop\javafx-sdk-15.0.1\lib" --add-modules javafx.controls GameGui.java
Run the code:
java --module-path "C:\Desktop\javafx-sdk-15.0.1\lib" --add-modules javafx.controls GameGui
I also already added the Jar library files into vsCode, under Java Projects > Referenced Libraries
I'm just worried that this is an issue with my code instead of the IDE. Does anyone know why this is happening?
Solution
Rather than clicking "CTRL + F5", i went to the run panel on the left hand side and at the top there is an option to select which file to run and changed it from "current file" to the name of the file i wanted and then clicked the green button. After that it started running normally, even when i use CTRL F5.
I found this comment under a JavaFX setup in vsCode youtube video, I tried it out and it worked.
Answered By - nana
Answer Checked By - Pedro (JavaFixing Volunteer)