Building OpenJFX with the JDK build system
John Neffenger
john at status6.com
Wed Mar 12 19:11:14 UTC 2025
On 2/27/25 7:15 AM, Johan Vos wrote:
> The POC I have for this (linux-only at the moment) is at
> https://github.com/johanvos/jdk/tree/jfxpoc-blog
That's very clever, Johan. I never thought of using the JDK repository
as-is to build JavaFX. I agree it's "one of the most excellent build
systems for software development today," so what a great idea to start
with that!
Your "proof of concept" repository builds successfully for me on Ubuntu
22.04 LTS and goes rather smoothly through the JavaFX modules:
Compiling up to 1 files for java.se
-> Compiling up to 312 files for javafx.base
Compiling up to 18 files for jdk.accessibility
Compiling up to 3 files for jdk.editpad
Compiling up to 904 files for jdk.hotspot.agent
Compiling up to 64 files for jdk.jconsole
Compiling up to 69 files for jdk.jpackage
Compiling up to 8 files for jdk.unsupported.desktop
-> Compiling up to 1695 files for javafx.graphics
-> Compiling up to 296 files for javafx.controls
The only rough edges are the 'javac' notes about deprecated APIs and
unchecked or unsafe operations in use by JavaFX. Also, as you note, the
'gcc' warnings are a bit jarring when you're accustomed to the sparse
output of the JDK build by itself.
After the build, the JavaFX JMOD files are found in the right place:
$ ls build/linux-x86_64-server-release/images/jdk/jmods/javafx*
build/linux-x86_64-server-release/images/jdk/jmods/javafx.base.jmod
build/linux-x86_64-server-release/images/jdk/jmods/javafx.controls.jmod
build/linux-x86_64-server-release/images/jdk/jmods/javafx.graphics.jmod
and the runtime image includes over 4,000 JavaFX classes:
$ jimage list build/linux-x86_64-server-release/images/jdk/lib/modules \
| grep javafx | wc -l
4009
I tested it with a "Hello World" JavaFX application on Ubuntu 24.04 LTS,
and it worked fine except for a minor error:
$ opt/jdk/bin/java --enable-native-access=javafx.graphics \
-jar tmp/dist/hello-javafx-1.0.0.jar
Mar 12, 2025 7:04:06 PM com.sun.javafx.css.StyleManager loadStylesheet
WARNING: Resource "com/sun/javafx/scene/control/skin/modena/modena.css"
not found.
Hello World!
So when can we switch?! :-)
Thanks,
John
More information about the openjfx-dev
mailing list