I have a Java FX project and upgraded the project to JDK 17 using the following Azul Zulu Build of OpenJDK with JavaFX
https://www.azul.com/downloads/?os=windows&package=jdk-fx
Does anyone have a clue why Intellij can't find JavaFX package using JDK 17 from Azul Zulu Builds of OpenJDK with FX?
I provide two solutions:
Using the Azul distribution which includes the JavaFX modules (which is what you asked for),
Using the Azul distribution which does not include JavaFX, and use the JavaFX modules from Maven Central using a build tool.
I recommend solution 2 using a build tool. It is a little quicker to set up and a more portable, flexible and extensible approach for future development work.
Alternate JDKs
These instructions should also work perfectly fine for other JDK and JavaFX distributions, such as those packaged by Belsoft Liberica, Amazon Correto and Eclipse Temurin.
To use an alternate vendor for the JDK, choose to download the appropriate version from the selected vendor, either:
Solution 1: Use Azul distribution with in-built JavaFX modules
Download Azul JDK:
This was my link for an Intel-based Mac version, but your link may differ depending on the architecture of your system:
Create a Java project (not a new JavaFX project):
File | New Project... | Java
Project SDK | Add JDK...
Choose the location you have extracted your Azul JDK with JavaFX download.
Leave default options, choose Next a few times.
Name the project and select Finish.
Create a JavaFX HelloWorld.java class:
Right-click on src, choose New | JavaFX Application.
Name it HelloWorld.
Edit the contents of the HelloWorld application to be:
Run the new JavaFX application in the IDE using Azul JDK + JavaFX runtime:
Troubleshooting
If you do the above and JavaFX classes cannot be found, you have probably not used a JDK which includes JavaFX.
In which case, unless you change JDK versions to one which does include JavaFX, you should download the JavaFX SDK from openjfx.io and follow the Idea project setup information provided there.
Solution 2: Use Azul, but source JavaFX modules from Maven Central
The solution below is to use Azul runtime with JavaFX modules sourced from the Maven Central Repository using Maven (or Gradle).
Create a JavaFX project:
Download and use Azul JDK in your project
You only need to do the Azul download and add step if you want to use it instead of the default JDK used for new Java projects in your IDE setup.
Run the new JavaFX application in the IDE using Azul JDK runtime and maven JavaFX modules: