0

I tried to build and start Gluons HelloFX example as native image for Windows. Building was successful but starting the resulting executable fails with this exception:

==================== RUN TASK ====================
[SUB] Nov 01, 2021 10:33:41 PM com.sun.javafx.application.PlatformImpl startup
[SUB] WARNING: Unsupported JavaFX configuration: classes were loaded from 'unnamed module @60723d6a'
[SUB] Exception in Application start method
[SUB] Exception in thread "main" java.lang.RuntimeException: Exception in Application start method
[SUB]     at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:901)
[SUB]     at com.sun.javafx.application.LauncherImpl.lambda$launchApplication$2(LauncherImpl.java:196)
[SUB]     at java.lang.Thread.run(Thread.java:829)
[SUB]     at com.oracle.svm.core.thread.JavaThreads.threadStartRoutine(JavaThreads.java:552)
[SUB]     at com.oracle.svm.core.windows.WindowsJavaThreads.osThreadStartRoutine(WindowsJavaThreads.java:138)
[SUB] Caused by: java.lang.NoSuchMethodError: com.sun.glass.ui.win.WinView.notifyResize(II)V
[SUB]     at com.oracle.svm.jni.functions.JNIFunctions$Support.getMethodID(JNIFunctions.java:1104)
[SUB]     at com.oracle.svm.jni.functions.JNIFunctions$Support.getMethodID(JNIFunctions.java:1089)
[SUB]     at com.oracle.svm.jni.functions.JNIFunctions.GetMethodID(JNIFunctions.java:410)
[SUB]     at com.sun.glass.ui.win.WinView._initIDs(WinView.java)
[SUB]     at com.sun.glass.ui.win.WinView.<clinit>(WinView.java:43)
[SUB]     at com.oracle.svm.core.classinitialization.ClassInitializationInfo.invokeClassInitializer(ClassInitializationInfo.java:375)
[SUB]     at com.oracle.svm.core.classinitialization.ClassInitializationInfo.initialize(ClassInitializationInfo.java:295)
[SUB]     at com.sun.glass.ui.win.WinApplication.createView(WinApplication.java:237)
[SUB]     at com.sun.javafx.tk.quantum.ViewScene.<init>(ViewScene.java:54)
[SUB]     at com.sun.javafx.tk.quantum.WindowStage.createTKScene(WindowStage.java:263)
[SUB]     at javafx.scene.Scene.initPeer(Scene.java:817)
[SUB]     at javafx.scene.Scene$2.initPeer(Scene.java:406)
[SUB]     at com.sun.javafx.scene.SceneHelper.initPeer(SceneHelper.java:74)
[SUB]     at javafx.stage.Window$12.invalidated(Window.java:1112)
[SUB]     at javafx.beans.property.BooleanPropertyBase.markInvalid(BooleanPropertyBase.java:110)
[SUB]     at javafx.beans.property.BooleanPropertyBase.set(BooleanPropertyBase.java:145)
[SUB]     at javafx.stage.Window.setShowing(Window.java:1190)
[SUB]     at javafx.stage.Window.show(Window.java:1205)
[SUB]     at javafx.stage.Stage.show(Stage.java:273)
[SUB]     at hellofx.HelloFX.start(HelloFX.java:55)
[SUB]     at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$9(LauncherImpl.java:847)
[SUB]     at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$12(PlatformImpl.java:484)
[SUB]     at com.sun.javafx.application.PlatformImpl.lambda$runLater$10(PlatformImpl.java:457)
[SUB]     at java.security.AccessController.doPrivileged(AccessController.java:105)
[SUB]     at com.sun.javafx.application.PlatformImpl.lambda$runLater$11(PlatformImpl.java:456)
[SUB]     at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:96)
[SUB]     at com.oracle.svm.jni.JNIJavaCallWrappers.jniInvoke_VA_LIST:Ljava_lang_Runnable_2_0002erun_00028_00029V(JNIJavaCallWrappers.java:0)
[SUB]     at com.sun.glass.ui.win.WinApplication._runLoop(WinApplication.java)
[SUB]     at com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(WinApplication.java:184)
[SUB]     ... 3 more

That was not the first exception I got. Before that I got:
Can't find bundle for base name com/sun/glass/ui/win/themes, locale en_US
I fixed that with answer from here.

I rigorously followed the instructions on the Gluon documentation.

The things I've done:

  • downloaded Gluons GraalVM version and extracted it
  • set the GRAALVM_HOME
  • downloaded VisualStudio 2019 CE and installed it with the required components
  • executed vcvars64.bat
  • cloned latest gluon-samples
  • cd HelloFX
  • mvn clean gluonfx:compile
  • mvn gluonfx:link

That all worked. But the last step - running the application - failed: mvn gluonfx:nativerun

What I did so far:

  • updated the gluonfx.maven.plugin.version from 1.0.7 to 1.0.8
  • used GraalVM CE 21.3.0 and added native-image-installable-svm-java11-windows-amd64-21.3.0.jar - and got the same error
  • added <bundlesList>com.sun.glass.ui.win.themes</bundlesList> to the gluonfx-maven-plugin configuration

The OS is Windows 10 Pro 64Bit.

Sven Döring
  • 3,927
  • 2
  • 14
  • 17

0 Answers0