Replies: 2 comments 1 reply
-
converting this discussion to an issue |
Beta Was this translation helpful? Give feedback.
0 replies
-
Hi @OlexYarm, I know this thread is old but for others: to build JavaFX apps with native-image you have to use the Gluon Substrate project: https://github.com/gluonhq/substrate Unfortunately, out of the box native-image doesn't work with JavaFX. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I built executable (native image) on Windows 11 for JavaFX Modular CLI sample application with Oracle GraalVM 22.0.1+8.1 (build 22.0.1+8-jvmci-b01).
I failed to run with error below:
Exception in thread "main" java.lang.RuntimeException: java.lang.ClassNotFoundException: hellofx.HelloFX
at javafx.graphics@22/javafx.application.Application.launch(Application.java:311)
at hellofx/hellofx.HelloFX.main(HelloFX.java:23)
Caused by: java.lang.ClassNotFoundException: hellofx.HelloFX
at org.graalvm.nativeimage.builder/com.oracle.svm.core.hub.ClassForNameSupport.forName(ClassForNameSupport.java:143)
at org.graalvm.nativeimage.builder/com.oracle.svm.core.hub.ClassForNameSupport.forName(ClassForNameSupport.java:106)
at [email protected]/java.lang.Class.forName(DynamicHub.java:1387)
at [email protected]/java.lang.Class.forName(DynamicHub.java:1377)
at javafx.graphics@22/javafx.application.Application.launch(Application.java:299)
... 1 more
Step to reproduce
cd /
gh repo clone openjfx/samples
cd CommandLine\Modular\CLI\hellofx
set PATH_TO_FX="C:\openjfx-22_windows-x64_bin-sdk\javafx-sdk-22\lib"
dir /s /b src*.java > sources.txt & javac --module-path %PATH_TO_FX% -d mods/hellofx @sources.txt & del sources.txt
java --module-path "%PATH_TO_FX%;mods" -m hellofx/hellofx.HelloFX
java -agentlib:native-image-agent=config-output-dir=native-image --module-path "%PATH_TO_FX%;mods" -m hellofx/hellofx.HelloFX
native-image --verbose --native-image-info -H:+UnlockExperimentalVMOptions -H:+BuildReport -g --no-fallback --module-path "%PATH_TO_FX%;mods" -m hellofx/hellofx.HelloFX --class-path "mods" -o jfxHello
jfxHello.exe
Beta Was this translation helpful? Give feedback.
All reactions