Setting up JavaFX with IntelliJ Idea on Ubuntu

Published by admin. 28. March 2020 No Comments
  1. Install IntelliJ
  2. Install JDK 14 from here
  3. Install JavaFX 14 SDK from here
  4. Set environment variable JAVA_HOME to your JDK installation, e.g. /usr/lib/jdk-14
  5. Start IntelliJ Idea and create a new JavaFX project
  6. Once created, navigate to File -> Project Structure -> Libraries and add the JavaFX library, pointing at the lib folder inside it, e.g. /home/user/Downloads/javafx-sdk-14
  7. Navigate to File -> Settings -> Appearance and Behavior -> Path Variables and add a new path variable. Name it PATH_TO_FX and set the value to the lib-folder inside your JavaFX library.
  8. Navigate to Run -> Edit Configurations… In the field VM options, paste this
--module-path ${PATH_TO_FX} --add-modules javafx.controls,javafx.fxml

Initially, I was struggling to get IntelliJ to recognize the JavaFX packages, that is because I stored the JavaFX library in a location with limit access rights, so IntelliJ couldn’t read it properly. If everything works fine, after you added the library, you will not be asked to chose a category. Instead, you will see this right away:

Leave a Reply

Your email address will not be published. Required fields are marked *