openjfx / javafx-gradle-plugin

Gradle plugin that makes it easy to work with JavaFX 11+
https://openjfx.io/
BSD 3-Clause "New" or "Revised" License
354 stars 62 forks source link

java.lang.ClassNotFoundException: com.sun.javafx.tk.quantum.QuantumToolkit #157

Open damnms opened 1 year ago

damnms commented 1 year ago

i have an application (https://gitlab.com/olze/chatclient) that i'd like to move to a native image. the build works but when i execute it, i get an error:

oli@DESKTOP-SJIB21T:~/IdeaProjects/chatclient/build/native/nativeCompile$ ./chatclient 
Sept. 30, 2023 8:12:15 AM 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)

as i am not sure which component is responsible for (javafx, graalvm, gradle javafx plugin), i thought i reference it here. the other bug is here: https://github.com/oracle/graal/issues/7521