Intellij not recognzing Javafx imports

Answered

I am using Intellij idea, trying to run a java fx project but it does not recognize any of the imports. If i make a new javafx project, everything is fine. But when i want to run this Java fx project i got from the internet, it just does not recognize the java fx imports. Im running oracle jdk 22.0.2. Im very much at a loss over here. Any help would be appreciated. I'll attach some screenshots below:

 

0
1 comment

JavaFX was removed from the JDK since JDK 11. It became a separate project - OpenJFX: https://openjfx.io/

In order to use JavaFX with versions 11+ of the JDK, you need to:

  1. Download the JavaFX JDK. Eg. from Oracle or Gluon: https://gluonhq.com/products/javafx/
  2. Extract the archive to any folder in your system
  3. In IntelliJ IDEA, go to File | Project Structure → Libraries
  4. Click the + button to add a new Java library
  5. Find the folder and select the lib subfolder as a source
  6. Hit OK and wait for indexing to finish

Alternatively, you can use Java 8 with the JavaFX libraries already present.

0

Please sign in to leave a comment.