Fix GraalVM native-image build for JavaFX applications#5
Merged
Conversation
Co-authored-by: lmangani <1423657+lmangani@users.noreply.github.com>
Co-authored-by: lmangani <1423657+lmangani@users.noreply.github.com>
Co-authored-by: lmangani <1423657+lmangani@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add GitHub actions for release build on OSX and Linux
Fix GraalVM native-image build for JavaFX applications
Jan 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
GraalVM native-image was failing with
ClassNotFoundException: com.sun.javafx.tk.quantum.QuantumToolkitdue to missing configuration for JavaFX's dynamically-loaded internal classes.Changes
GraalVM Configuration (
src/main/resources/META-INF/native-image/com.fedeiatech.spritelab/SpriteLab/)reflect-config.json: Added reflection entries for JavaFX internals:
com.sun.javafx.tk.quantum.QuantumToolkit(toolkit loader)com.sun.glass.ui.{mac,gtk}.*)com.sun.prism.{es2,sw}.*)com.sun.scenario.effect.impl.sw.sse.*)jni-config.json (new): JNI access for native JavaFX components interfacing with platform graphics APIs
native-image.properties: Run-time initialization for platform-specific JavaFX classes:
Documentation
The existing CI and release workflows (Linux amd64, macOS arm64) will now build successfully.
Original prompt
This section details on the original issue you should resolve
<issue_title>Release Build Actions</issue_title>
<issue_description>Let's add github actions to generate builds for OSX (arm64/metal) and Linux (amd64) on a release trigger.
Development (Build)
Language: Java 21 (JavaFX)
Dependencies: FFmpeg (Local binaries required in /bin)</issue_description>
<agent_instructions>Resolve this issue and make sure its replicated and addressed in our CI
/SpriteLab-macOS-arm64/SpriteLab ; exit;
Jan 22, 2026 4:21:18 PM com.sun.javafx.application.PlatformImpl startup
WARNING: Unsupported JavaFX configuration: classes were loaded from 'unnamed module @56afdf9a'
java.lang.ClassNotFoundException: com.sun.javafx.tk.quantum.QuantumToolkit
at org.graalvm.nativeimage.builder/com.oracle.svm.core.hub.ClassForNameSupport.forName(ClassForNameSupport.java:126)
at org.graalvm.nativeimage.builder/com.oracle.svm.core.hub.ClassForNameSupport.forName(ClassForNameSupport.java:87)
at java.base@21.0.10/java.lang.Class.forName(DynamicHub.java:1359)
at java.base@21.0.10/java.lang.Class.forName(DynamicHub.java:1348)
at com.sun.javafx.tk.Toolkit.getToolkit(Toolkit.java:253)
at com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:290)
at com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:162)
at com.sun.javafx.application.LauncherImpl.startToolkit(LauncherImpl.java:651)
at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:671)
at com.sun.javafx.application.LauncherImpl.lambda$launchApplication$2(LauncherImpl.java:196)
at java.base@21.0.10/java.lang.Thread.runWith(Thread.java:1596)
at java.base@21.0.10/java.lang.Thread.run(Thread.java:1583)
at org.graalvm.nativeimage.builder/com.oracle.svm.core.thread.PlatformThreads.threadStartRoutine(PlatformThreads.java:896)
at org.graalvm.nativeimage.builder/com.oracle.svm.core.thread.PlatformThreads.threadStartRoutine(PlatformThreads.java:872)
Exception in thread "main" java.lang.RuntimeException: No toolkit found
at com.sun.javafx.tk.Toolkit.getToolkit(Toolkit.java:275)
at com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:290)
at com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:162)
at com.sun.javafx.application.LauncherImpl.startToolkit(LauncherImpl.java:651)
at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:671)
at com.sun.javafx.application.LauncherImpl.lambda$launchApplication$2(LauncherImpl.java:196)
at java.base@21.0.10/java.lang.Thread.runWith(Thread.java:1596)
at java.base@21.0.10/java.lang.Thread.run(Thread.java:1583)
at org.graalvm.nativeimage.builder/com.oracle.svm.core.thread.PlatformThreads.threadStartRoutine(PlatformThreads.java:896)
at org.graalvm.nativeimage.builder/com.oracle.svm.core.thread.PlatformThreads.threadStartRoutine(PlatformThreads.java:872)
Saving session...
...copying shared history...
...saving history...truncating history files...
...completed.
Deleting expired sessions...none found.
[Process completed]
</agent_instructions>
Comments on the Issue (you are @copilot in this section)
@lmangani /SpriteLab-macOS-arm64/SpriteLab ; exit; Jan 22, 2026 4:21:18 PM com.sun.javafx.application.PlatformImpl startup WARNING: Unsupported JavaFX configuration: classes were loaded from 'unnamed module @56afdf9a' java.lang.ClassNotFoundException: com.sun.javafx.tk.quantum.QuantumToolkit at org.graalvm.nativeimage.builder/com.oracle.svm.core.hub.ClassForNameSupport.forName(ClassForNameSupport.java:126) at org.graalvm.nativeimage.builder/com.oracle.svm.core.hub.ClassForNameSupport.forName(ClassForNameSupport.java:87) at java.base@21.0.10/java.lang.Class.forName(DynamicHub.java:1359) at java.base@21.0.10/java.lang.Class.forName(DynamicHub.java:1348) at com.sun.javafx.tk.Toolkit.getToolkit(Toolkit.java:253) at com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:290) at com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:162) at com.sun.javafx.application.LauncherImpl.startToolkit(LauncherImpl.java:651) at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:671) at com.sun.javafx.application.LauncherImpl.lambda$launchApplication$2(LauncherImpl.java:196) at java.base@21.0.10/java.lang.Thread.runWith(Thread.java:1596) at java.base@21.0.10/java.lang.Thread.run(Thread.java:1583) at org.graalvm.nativeimage.builder/com.oracle.svm.core.thread.PlatformThreads.threadStartRoutine(PlatformThreads.java:896) at org.graalvm.nativeimage.builder/com.oracle.svm.core.thread.PlatformThreads.threadStartRoutine(PlatformThreads.java:872) Exception in thread "main" java.lang.RuntimeException: No toolkit found at com.sun.javafx.tk.Toolkit.getToolkit(Toolkit.java:275) at com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:290) at com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:162) at com.sun.javafx.applicati...💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.