skip to Main Content

I’ve been trying to set up on JavaFX in VSCode. I added the JavaFX jar files to the referenced libraries and added the following statement to launch.json (obviously with my path to the lib folder):

"vmArgs": "--module-path "C:/path/to/javafx-sdk-19/lib" --add-modules javafx.controls,javafx.fxml"

This is exactly what multiple youtube videos and other StackOverflow posts have said to do, but I still keep getting this error.

(I know that I can use Maven or Gradle in VScode but am completely unfamiliar with both and still want to try to make this work.)

Hopefully I didn’t miss anything painfully obvious but thank you for any help.

2

Answers


    1. You should download JavaFX for your JDK version.
    2. Uncompress JavaFX.zip and move bin folder to your project.
    3. You should create two classes, one for writing the JavaFX window code and one for running it.

    The error can be fixed.

    I suggest you learn how to use Maven or Gradle in vscode. It is very important.

    Login or Signup to reply.
  1. At runtime, your app needs access to the JavaFX (OpenJFX) libraries.

    Either:

    • Install a copy of the OpenJFX libraries with your app, as directed in the Answer by RedSnack-BCS.
    • Replace your Java implementation with one that includes the OpenJFX libraries.

    I know of two such implementations of Java (JDKs) that include necessary libraries:

    • ZuluFX, a special edition of their Zulu product, by Azul Systems.
    • LibericaFX, a special edition of their Liberica product, by BellSoft.

    You may have identified a third approach with the use of passing arguments to the JVM. But I am not familiar with that solution.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search