-1

i want to install JavaFX in VSCode. I downloaded the SDK and added the files with the Referenced libaries and they also appear in the settings.json. So I added the Files correctly. I also addes this in the launch.json:

"vmArgs": "--module-path C:/JavaFX/lib --add-modules javafx.controls,javafx.fxml,javafx.web,javafx.graphics"

But still every time I try to run my programm this appears:

App.java:1: error: package javafx.application does not exist
import javafx.application.Application;

App.java:2: error: package javafx.event does not exist
import javafx.event.ActionEvent;

App.java:3: error: package javafx.event does not exist
import javafx.event.EventHandler;

App.java:4: error: package javafx.scene does not exist
import javafx.scene.Scene;

App.java:5: error: package javafx.scene.control does not exist

App.java:6: error: package javafx.scene.layout does not exist

App.java:7: error: package javafx.stage does not exist

App.java:9: error: cannot find symbol

I don't know what to do anymore I tried to follow many tutorials but not one helped.

Joachim Sauer
  • 302,674
  • 57
  • 556
  • 614
Chrissi
  • 15
  • 8
  • Does this answer help you? [How can I use javafx in visual studio code](https://stackoverflow.com/questions/69294852/how-can-i-use-javafx-in-visual-studio-code) – Molly Wang-MSFT Oct 06 '21 at 03:04

1 Answers1

0

Try this: Add JavaFX jmods to java --list-modules

Or another solution is merge JavaFx with JDK by downloading jmods files of the JDK and JavaFx, then use jlink to merge the jmods files together to get one SDK contains JDK and JavaFx, read about this below under section "Custom JDK+JavaFX image".

https://openjfx.io/openjfx-docs/#modular