I want to javafx in vs code as for versions I am using jdk-16.0.2.7-hotspot How can I use javafx in my projects? Is it possible?
CodePudding user response:
First, ensure that you're using the latest version of VSCode. Then, click on Settings (Gear icon at the bottom left), click on extensions, type JavaFX, Install JavaFX Support and FXML viewer. Then, install JavaFX library. (Link). Create a new project, in the explorer tab, in java projects, click on Plus sign in referenced libraries. Point it towards your installation directory of JavaFX SDK.
Add this to VM Option,
--module-path /path/to/JavaFX/lib --add-modules=javafx.controls
(make sure to paste path to javafx lib folder after --module-path)
Make sure you have your runtime defined in VSCode, and it should be done :)