0

I have installed openjdk 11 and openjfx (using "apt get install openjfx").
Tried to use "import javafx" and "import openjfx" in the code and javac always says that there is no such package.

1 Answer 1

2

There is a new way to work with JavaFX if you are using Java 11. This is their official web site: https://openjfx.io/openjfx-docs/#install-javafx

Inside is described how to:

  • Install Java 11 (JRE or JDK)
  • Download their JavaFX runtime from: https://gluonhq.com/products/javafx/
  • Export the path of the JavaFX runtime: export PATH_TO_FX=path/to/javafx-sdk-11/lib
  • compile and run java application with module path to the PATH_TO_FX and the necessary modules:

    • javac --module-path $PATH_TO_FX --add-modules javafx.controls (other javaFX modules) HelloFX.java

    • java --module-path $PATH_TO_FX --add-modules javafx.controls (other javaFX modules) HelloFX

For more information please visit their website read https://openjfx.io/openjfx-docs/#install-javafx and also read some information on java 9 module system.

Best luck to all!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.