Open UtilFunction opened 1 year ago
I wrote a project that worked through JavaFX's media module, Native Image, and was working with the media module. If you are interested, you can come to my Repository: https://github.com/natsufumij/javafx-native-media-demo
I wrote a project that worked through JavaFX's media module, Native Image, and was working with the media module. If you are interested, you can come to my Repository: https://github.com/natsufumij/javafx-native-media-demo
That's not a Gradle project. Maven works just fine as I've described in my OP.
Hi, Please elaborate on how you manage to build javaFX native image with this plugin. Which version of Graal you you using?
I thought this could only be accomplished with https://github.com/gluonhq/gluonfx-maven-plugin/
Thanks
not sure if i have the exact same problem, but somehow feels its going to the same direction:
oli@fedora:~/IdeaProjects/chatclient/build/native/nativeCompile$ ./chatclient
Sept. 27, 2023 2:38:03 PM com.sun.javafx.application.PlatformImpl startup
WARNUNG: Unsupported JavaFX configuration: classes were loaded from 'unnamed module @10bdf5e5'
java.lang.ClassNotFoundException: com.sun.javafx.tk.quantum.QuantumToolkit
at org.graalvm.nativeimage.builder/com.oracle.svm.core.hub.ClassForNameSupport.forName(ClassForNameSupport.java:122)
at org.graalvm.nativeimage.builder/com.oracle.svm.core.hub.ClassForNameSupport.forName(ClassForNameSupport.java:86)
at java.base@21/java.lang.Class.forName(DynamicHub.java:1346)
at java.base@21/java.lang.Class.forName(DynamicHub.java:1335)
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/java.lang.Thread.runWith(Thread.java:1596)
at java.base@21/java.lang.Thread.run(Thread.java:1583)
at org.graalvm.nativeimage.builder/com.oracle.svm.core.thread.PlatformThreads.threadStartRoutine(PlatformThreads.java:833)
at org.graalvm.nativeimage.builder/com.oracle.svm.core.posix.thread.PosixPlatformThreads.pthreadStartRoutine(PosixPlatformThreads.java:211)
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/java.lang.Thread.runWith(Thread.java:1596)
at java.base@21/java.lang.Thread.run(Thread.java:1583)
at org.graalvm.nativeimage.builder/com.oracle.svm.core.thread.PlatformThreads.threadStartRoutine(PlatformThreads.java:833)
at org.graalvm.nativeimage.builder/com.oracle.svm.core.posix.thread.PosixPlatformThreads.pthreadStartRoutine(PosixPlatformThreads.java:211)
the source is available at https://gitlab.com/olze/chatclient - i am kinda lost and give up with graalvm for now (again...)
I have reason to believe that there is a problem with the javafx-gradle-plugin that causes it not to work with Graal Native.
To compile a JavaFX application natively, one usually needs to run an application with Graal's tracing agent to generate configuration files that can then be provided to the Graal compiler.
This works with both Maven and even Scala's sbt, but when doing this with a Gradle project, this error occurs:
Graphics device initialization failed for : d3d, sw
or ratherGraphics device initialization failed for : es2, sw
.Gluon will tell you to use the Gluon plugin instead of the Graal plugin, but that shouldn't be necessary at all, because as I mentioned before, it works with both sbt and Maven and even with Gluon's Gradle plugin it won`t work and you have to switch to SWRendering.