edvin / tornadofx

Lightweight JavaFX Framework for Kotlin
Apache License 2.0
3.68k stars 272 forks source link

How can i build a native image using tornadofx #1354

Closed Anivie closed 1 year ago

Anivie commented 2 years ago

I am tring to build a native-image with my tornadofx program,but it has this error:

ARNING: Unable to install CSS url handler, type safe stylesheets might not work
java.net.MalformedURLException: Accessing an URL protocol that was not enabled. The URL protocol css is not tested and might not work as expected. It can be enabled by adding the --enable-url-protocols=css option to the native-image command.
        at com.oracle.svm.core.jdk.JavaNetSubstitutions.unsupported(JavaNetSubstitutions.java:222)
        at com.oracle.svm.core.jdk.JavaNetSubstitutions.getURLStreamHandler(JavaNetSubstitutions.java:177)
        at java.net.URL.getURLStreamHandler(URL.java:72)
        at java.net.URL.<init>(URL.java:651)
        at java.net.URL.<init>(URL.java:541)
        at java.net.URL.<init>(URL.java:488)
        at tornadofx.Stylesheet$Companion.detectAndInstallUrlHandler(CSS.kt:469)
        at tornadofx.Stylesheet$Companion.access$detectAndInstallUrlHandler(CSS.kt:97)
        at tornadofx.Stylesheet.<clinit>(CSS.kt:448)
        at com.oracle.svm.core.classinitialization.ClassInitializationInfo.invokeClassInitializer(ClassInitializationInfo.java:375)
        at com.oracle.svm.core.classinitialization.ClassInitializationInfo.initialize(ClassInitializationInfo.java:295)
        at tornadofx.App.<init>(App.kt:73)
        at me.dkim19375.project.Project.<init>(Project.kt:25)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:490)
        at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$8(LauncherImpl.java:802)
        at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$12(PlatformImpl.java:455)
        at com.sun.javafx.application.PlatformImpl.lambda$runLater$10(PlatformImpl.java:428)
        at java.security.AccessController.doPrivileged(AccessController.java:100)
        at com.sun.javafx.application.PlatformImpl.lambda$runLater$11(PlatformImpl.java:427)
        at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:96)
        at com.oracle.svm.jni.JNIJavaCallWrappers.jniInvoke_VA_LIST:Ljava_lang_Runnable_2_0002erun_00028_00029V(JNIJavaCallWrappers.java:0)
        at com.sun.glass.ui.win.WinApplication._runLoop(WinApplication.java)
        at com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(WinApplication.java:174)
        at java.lang.Thread.run(Thread.java:829)
        at com.oracle.svm.core.thread.JavaThreads.threadStartRoutine(JavaThreads.java:553)
        at com.oracle.svm.core.windows.WindowsJavaThreads.osThreadStartRoutine(WindowsJavaThreads.java:138)

Event i using --enable-url-protocols=css to build,this error still exists

valnaumov commented 1 year ago

@Anivie Have you managed to build a native image?