Issue
After installing both the OpenJDK and the Temurin casks (testing out first one, then the other), I'm still getting errors like these when running a simple example javafx app from the terminal:
Example.java:1: error: package javafx.application does not exist
It seems to me like JavaFX is not included in OpenJDK for macOS, at least the Homebrew versions, but it should be.
The version I'm installing is 17, on both counts.
What can I do to fix this? (I specifically don't want to install Oracle's JDK, to avoid hefty future licensing fees or potential litigation, which Oracle is known for.)
Solution
JavaFX has never been an official part of the Java platform.
For a while, Oracle was bundling the JavaFX libraries with their own Oracle JDK product, but later stopped. Those libraries were a bonus, an extra, not required by the Java specifications.
Keep in mind that several vendors provide Java implementations. At least two of them provide a variant that includes the OpenJFX libraries implementing JavaFX, if that is what you want:
- ZuluFX by Azul Systems
- LibericaFX from BellSoft
Last time I looked, both of those products were available for macOS on both Intel Macs and Apple Silicon Macs.
Alternatively, you can bundle the OpenJFX libraries within your app.
Answered By - Basil Bourque