Running native image on windows

0 votes
asked Mar 1, 2025 in Question / help by albert (3,620 points)

I downloaded the plantuml-headless-win-amd64-1.2025.1.zip and extracted the files from it in the local bin  directory.
I have a small  plantuml file (aa.pu):

@startuml
Alice -> Bob : Hello
@enduml

and ran bin\plantuml-headless.exe -help which showed met the normal (java) help information.
When running bin\plantuml-headless.exe -tpng -o aa.png aa.pu  I got a big stack trace with at the top:

java.lang.NoClassDefFoundError: java/util/HashMap
        at org.graalvm.nativeimage.builder/com.oracle.svm.core.jni.functions.JNIFunctions.FindClass(JNIFunctions.java:359)
        at java.desktop@21.0.6/sun.awt.Win32FontManager.populateFontFileNameMap0(Native Method)

So it might be a lack in my knowledge or  that the, windows, native image is incomplete.

  • What did I do wrong?
commented Mar 2, 2025 by albert (3,620 points)
edited Mar 2, 2025 by albert

In the mean time I got a little further when trying the full version native image like:

bin\plantuml-full.exe -Djava.awt.headless=true -tpng -o aa.png aa.pu

this gave a correct output image but the file was in a directory: aa.png\aa.png and it also produced a stack trace:

Exception in thread "AWT-Windows": java.lang.NoSuchMethodError
java.lang.NoSuchMethodError: sun.java2d.d3d.D3DRenderQueue$1.run()V
        at org.graalvm.nativeimage.builder/com.oracle.svm.core.jni.functions.JNIFunctions$Support.getMethodID(JNIFunctions.java:1341)
        at org.graalvm.nativeimage.builder/com.oracle.svm.core.jni.functions.JNIFunctions$Support.getMethodID(JNIFunctions.java:1326)
        at org.graalvm.nativeimage.builder/com.oracle.svm.core.jni.functions.JNIFunctions.GetMethodID(JNIFunctions.java:431)
        at java.desktop@21.0.6/sun.awt.windows.WToolkit.eventLoop(Native Method)
        at java.desktop@21.0.6/sun.awt.windows.WToolkit.run(WToolkit.java:360)
        at java.base@21.0.6/java.lang.Thread.runWith(Thread.java:1596)
        at java.base@21.0.6/java.lang.Thread.run(Thread.java:1583)
        at org.graalvm.nativeimage.builder/com.oracle.svm.core.thread.PlatformThreads.threadStartRoutine(PlatformThreads.java:902)
        at org.graalvm.nativeimage.builder/com.oracle.svm.core.thread.PlatformThreads.threadStartRoutine(PlatformThreads.java:878)
Exception in thread "AWT-Windows": java.lang.NoSuchMethodError
java.lang.NoSuchMethodError: sun.java2d.d3d.D3DGraphicsDevice$1.run()V
        at org.graalvm.nativeimage.builder/com.oracle.svm.core.jni.functions.JNIFunctions$Support.getMethodID(JNIFunctions.java:1341)
        at org.graalvm.nativeimage.builder/com.oracle.svm.core.jni.functions.JNIFunctions$Support.getMethodID(JNIFunctions.java:1326)
        at org.graalvm.nativeimage.builder/com.oracle.svm.core.jni.functions.JNIFunctions.GetMethodID(JNIFunctions.java:431)
        at java.desktop@21.0.6/sun.awt.windows.WToolkit.eventLoop(Native Method)
        at java.desktop@21.0.6/sun.awt.windows.WToolkit.run(WToolkit.java:360)
        at java.base@21.0.6/java.lang.Thread.runWith(Thread.java:1596)
        at java.base@21.0.6/java.lang.Thread.run(Thread.java:1583)
        at org.graalvm.nativeimage.builder/com.oracle.svm.core.thread.PlatformThreads.threadStartRoutine(PlatformThreads.java:902)
        at org.graalvm.nativeimage.builder/com.oracle.svm.core.thread.PlatformThreads.threadStartRoutine(PlatformThreads.java:878)

I also tried the latest snapshot (snapshot - Native Image (~v1.2025.2beta3)) but with the same result.

So looks like here are also some problems.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:

[Antispam2 Feature: please please wait 1 or 2 minutes (this message will disappear) before pressing the button otherwise it will fail](--------)
To avoid this verification in future, please log in or register.
...