dkim19375
dkim19375

Reputation: 31

GraalVM Compatibility with TornadoFX CSS URL Protocols

I'm trying to use GraalVM Native Image tool to create an executable that can be ran without the need of java installed. I'm also looking to prevent the need of an installer for my program too, and so I found GraalVM Native Image. However, when I try running my program I get this error:

Jun 26, 2021 4:56:42 PM tornadofx.Stylesheet$Companion detectAndInstallUrlHandler
INFO: Installing CSS url handler, since it was not picked up automatically
Jun 26, 2021 4:56:42 PM tornadofx.Stylesheet$Companion detectAndInstallUrlHandler
WARNING: 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)

Exception in Application start method

So, as the error suggests, I added the --enable-url-protocols=css option to the native-image command. However, I get this warning when running the native image command:

The URL protocol css is not tested and might not work as expected.
Supported URL protocols enabled by default: file,resource. Supported URL protocols available on demand: http,https.
Registering the css URL protocol failed. It will not be available at runtime.

And when running the program, I get the same error I did before.

Is this caused by type-safe stylesheets? If so, is there a way to fix or disable it?

Note: If you look in the stacktrace you'll see it pointing to my code (Project.kt:25) - that's where I call the constructor of App(StartView::class), the full code on that line being

class Project : App(StartView::class)

Upvotes: 0

Views: 179

Answers (0)

Related Questions