plantuml icon indicating copy to clipboard operation
plantuml copied to clipboard

Produce a native image using GraalVM

Open ggrossetie opened this issue 2 years ago • 15 comments

Is your feature request related to a problem? Please describe. I would like to use PlantUML CLI as a native image:

$ echo 'Alice->Bob: Hello' | ./plantuml -tpng -pipe > diagram.png

Describe the solution you'd like I was able to produce a native image using GraalVM on Ubuntu:

$ /path/to/graalvm-ce-java17-22.3.1/bin/native-image -H:ConfigurationFileDirectories=./native-image-config-dir --no-fallback --report-unsupported-elements-at-runtime -jar plantuml-1.2023.4.jar
========================================================================================================================
GraalVM Native Image: Generating 'plantuml-1.2023.4' (executable)...
========================================================================================================================
[1/7] Initializing...                                                                                    (2,5s @ 0,22GB)
 Version info: 'GraalVM 22.3.1 Java 17 CE'
 Java version info: '17.0.6+10-jvmci-22.3-b13'
 C compiler: gcc (linux, x86_64, 11.3.0)
 Garbage collector: Serial GC
[2/7] Performing analysis...  [******]                                                                  (12,1s @ 3,33GB)
  11 171 (88,31%) of 12 650 classes reachable
  21 887 (67,71%) of 32 323 fields reachable
  58 772 (61,05%) of 96 267 methods reachable
     200 classes,    96 fields, and 1 098 methods registered for reflection
     129 classes,   200 fields, and   115 methods registered for JNI access
       7 native libraries: dl, freetype, m, pthread, rt, stdc++, z
[3/7] Building universe...                                                                               (1,3s @ 3,25GB)
[4/7] Parsing methods...      [*]                                                                        (1,0s @ 2,32GB)
[5/7] Inlining methods...     [***]                                                                      (0,7s @ 2,75GB)
[6/7] Compiling methods...    [***]                                                                     (10,5s @ 3,33GB)
[7/7] Creating image...                                                                                  (1,8s @ 1,87GB)
  31,77MB (50,30%) for code area:    37 017 compilation units
  26,68MB (42,24%) for image heap:  292 532 objects and 109 resources
   4,72MB ( 7,47%) for other data
  63,17MB in total
------------------------------------------------------------------------------------------------------------------------
Top 10 packages in code area:                               Top 10 object types in image heap:
 953,14KB java.util                                            6,70MB byte[] for code metadata
 796,22KB sun.font                                             3,09MB java.lang.String
 778,06KB gen.lib.dotgen                                       2,68MB java.lang.Class
 683,21KB java.awt                                             2,39MB byte[] for general heap data
 561,52KB gen.lib.common                                       2,17MB byte[] for java.lang.String
 526,17KB java.lang.invoke                                     1,03MB byte[] for embedded resources
 495,03KB javax.swing                                       1017,65KB int[]
 466,31KB c.s.org.apache.xerces.internal.impl.xs.traversers  960,01KB com.oracle.svm.core.hub.DynamicHubCompanion
 464,52KB sun.awt.X11                                        632,55KB java.lang.String[]
 464,49KB java.lang                                          552,14KB java.util.HashMap$Node
  25,46MB for 467 more packages                                5,20MB for 1788 more object types
------------------------------------------------------------------------------------------------------------------------
                        2,1s (6,5% of total time) in 37 GCs | Peak RSS: 7,68GB | CPU load: 11,03
------------------------------------------------------------------------------------------------------------------------
Produced artifacts:
 /path/to/plantuml-1.2023.4 (executable)
 /path/to/plantuml-1.2023.4.build_artifacts.txt (txt)
========================================================================================================================
Finished generating 'plantuml-1.2023.4' in 32,4s.

We need to specify a configure directory since PlantUML relies on java.awt.image/JNI. The configuration can be generated using the following command:

$ mkdir native-image-config-dir
$ echo 'Bob->Alice: Hello' | /path/to/graalvm-ce-java17-22.3.1/bin/java -agentlib:native-image-agent=config-output-dir=./native-image-config-dir -jar plantuml-1.2023.4.jar -tpng -pipe > out.png

It will run PlantUML with an agent which will record every calls and produce several configuration files in the native-image-config-dir directory.

I can build the native image on my side but I think it would be great to publish it as part of the release process.

Keep in mind that (currently) it only works for CLI (i.e., the GUI won't show):

$ ./plantuml-1.2023.4
There is an issue with your server. You will find some tips here:
https://forum.plantuml.net/3399/problem-with-x11-and-headless-exception
https://plantuml.com/en/faq#239d64f675c3e515
Exception in thread "main" java.awt.HeadlessException
	at [email protected]/java.awt.GraphicsEnvironment.checkHeadless(GraphicsEnvironment.java:166)
	at [email protected]/java.awt.Window.<init>(Window.java:553)
	at [email protected]/java.awt.Frame.<init>(Frame.java:428)
	at [email protected]/javax.swing.JFrame.<init>(JFrame.java:224)
	at net.sourceforge.plantuml.swing.MainWindow.<init>(MainWindow.java:159)
	at net.sourceforge.plantuml.Run.main(Run.java:178)

It might be possible to make it work but since I'm only interested in the CLI... 😄

Additional context I can prepare a GitHub Action to demonstrate how to build the native image from a jar file.

ggrossetie avatar Mar 19 '23 11:03 ggrossetie

java

$ time echo "Alice->Bob: Hello" | java -jar plantuml-1.2023.4.jar -tpng -pipe > native.png && open native.png

real  0m0,388s
user  0m1,073s
sys   0m0,076s

java

native

$ time echo "Alice->Bob: Hello" | ./plantuml-1.2023.4 -tpng -pipe > native.png && open native.png

real  0m0,060s
user  0m0,034s
sys   0m0,029s

native

ggrossetie avatar Mar 19 '23 11:03 ggrossetie

Nice work thank you.

I was thinking of it. Maybe we can create a docker image and use it in a github workflow ?

evantill avatar Mar 19 '23 11:03 evantill

Maybe we can create a docker image and use it in a github workflow ?

I don't think we need a Docker image but I can open a pull request with a GitHub Action running on ubuntu-latest.

ggrossetie avatar Mar 19 '23 11:03 ggrossetie

Additional context I can prepare a GitHub Action to demonstrate how to build the native image from a jar file.

Yes, that would be great. And we could also integrate this in our main CI/CD so that we also release this native image.

arnaudroques avatar Mar 19 '23 11:03 arnaudroques

The docker image would help us during development on our computers. Some of us are on Windows, other on macos... And this image could be reused in the github workflow.

We have just started a new repository for every thing related to docker image creation https://github.com/plantuml/docker

evantill avatar Mar 19 '23 11:03 evantill

@ggrossetie you can go on the PR for the github workflow and we will see later on the docker image stuff I will create an other issue for the docker related stuff

evantill avatar Mar 19 '23 11:03 evantill

Hi everyone, thanks for reporting! Could you please go to the releases section here and check out the current b native builds? I'm the one who implemented the support, so I'm happy to fix any issues you find there

asm0dey avatar Aug 28 '24 04:08 asm0dey

Looks like there are nowadays native images available. I tried it on Windows but got a stack trace, see https://forum.plantuml.net/19761/running-native-image-on-windows

albert-github avatar Mar 02 '25 08:03 albert-github

@albert-github I'll send it to my team, thanks

asm0dey avatar Mar 02 '25 10:03 asm0dey

I would test it myself, but I do not have a windows machine :(

asm0dey avatar Mar 02 '25 11:03 asm0dey

Reproduced with wine, full stack trace

java.lang.NoClassDefFoundError: java/util/HashMap
        at org.graalvm.nativeimage.builder/com.oracle.svm.core.jni.functions.JNIFunctions.FindClass(JNIFunctions.java:359)
        at [email protected]/sun.awt.Win32FontManager.populateFontFileNameMap0(Native Method)
        at [email protected]/sun.awt.Win32FontManager.populateFontFileNameMap(Win32FontManager.java:195)
        at [email protected]/sun.font.SunFontManager.getFullNameToFileMap(SunFontManager.java:1608)
        at [email protected]/sun.font.SunFontManager.gotFontsFromPlatform(SunFontManager.java:1658)
        at [email protected]/sun.font.SunFontManager$8.run(SunFontManager.java:2956)
        at [email protected]/sun.font.SunFontManager$8.run(SunFontManager.java:2946)
        at [email protected]/java.security.AccessController.executePrivileged(AccessController.java:129)
        at [email protected]/java.security.AccessController.doPrivileged(AccessController.java:319)
        at [email protected]/sun.font.SunFontManager.loadFonts(SunFontManager.java:2946)
        at [email protected]/sun.font.SunFontManager.loadFontFiles(SunFontManager.java:3053)
        at [email protected]/sun.font.SunFontManager.getInstalledFontFamilyNames(SunFontManager.java:3379)
        at [email protected]/sun.java2d.SunGraphicsEnvironment.getAvailableFontFamilyNames(SunGraphicsEnvironment.java:172)
        at [email protected]/sun.java2d.SunGraphicsEnvironment.getAvailableFontFamilyNames(SunGraphicsEnvironment.java:195)
        at [email protected]/sun.java2d.HeadlessGraphicsEnvironment.getAvailableFontFamilyNames(HeadlessGraphicsEnvironment.java:80)
        at net.sourceforge.plantuml.klimt.font.UFont.<clinit>(UFont.java:95)
        at net.sourceforge.plantuml.style.Style.getUFont(Style.java:228)
        at net.sourceforge.plantuml.style.Style.getFontConfiguration(Style.java:241)
        at net.sourceforge.plantuml.style.Style.getFontConfiguration(Style.java:237)
        at net.sourceforge.plantuml.skin.AbstractTextualComponent.<init>(AbstractTextualComponent.java:121)
        at net.sourceforge.plantuml.skin.rose.ComponentRoseParticipant.<init>(ComponentRoseParticipant.java:105)
        at net.sourceforge.plantuml.skin.rose.Rose.createComponent(Rose.java:180)
        at net.sourceforge.plantuml.sequencediagram.graphic.DrawableSetInitializer.prepareParticipant(DrawableSetInitializer.java:671)
        at net.sourceforge.plantuml.sequencediagram.graphic.DrawableSetInitializer.createDrawableSet(DrawableSetInitializer.java:176)
        at net.sourceforge.plantuml.sequencediagram.graphic.SequenceDiagramFileMakerPuma2.<init>(SequenceDiagramFileMakerPuma2.java:142)
        at net.sourceforge.plantuml.sequencediagram.SequenceDiagram.getSequenceDiagramPngMaker(SequenceDiagram.java:319)
        at net.sourceforge.plantuml.sequencediagram.SequenceDiagram.getNbImages(SequenceDiagram.java:512)
        at net.sourceforge.plantuml.PSystemUtils.exportDiagramsSequence(PSystemUtils.java:177)
        at net.sourceforge.plantuml.PSystemUtils.exportDiagrams(PSystemUtils.java:124)
        at net.sourceforge.plantuml.SourceFileReaderAbstract.getGeneratedImages(SourceFileReaderAbstract.java:226)
        at net.sourceforge.plantuml.Run.manageFileInternal(Run.java:562)
        at net.sourceforge.plantuml.Run.processArgs(Run.java:456)
        at net.sourceforge.plantuml.Run.manageAllFiles(Run.java:423)
        at net.sourceforge.plantuml.Run.main(Run.java:258)
        at [email protected]/java.lang.invoke.LambdaForm$DMH/sa346b79c.invokeStaticInit(LambdaForm$DMH)

asm0dey avatar Mar 02 '25 12:03 asm0dey

@asm0dey What you showed looks like what I got on my windows machine.

For completeness my full trace:

java.lang.NoClassDefFoundError: java/util/HashMap
        at org.graalvm.nativeimage.builder/com.oracle.svm.core.jni.functions.JNIFunctions.FindClass(JNIFunctions.java:359)
        at [email protected]/sun.awt.Win32FontManager.populateFontFileNameMap0(Native Method)
        at [email protected]/sun.awt.Win32FontManager.populateFontFileNameMap(Win32FontManager.java:195)
        at [email protected]/sun.font.SunFontManager.getFullNameToFileMap(SunFontManager.java:1608)
        at [email protected]/sun.font.SunFontManager.gotFontsFromPlatform(SunFontManager.java:1658)
        at [email protected]/sun.font.SunFontManager$8.run(SunFontManager.java:2956)
        at [email protected]/sun.font.SunFontManager$8.run(SunFontManager.java:2946)
        at [email protected]/java.security.AccessController.executePrivileged(AccessController.java:129)
        at [email protected]/java.security.AccessController.doPrivileged(AccessController.java:319)
        at [email protected]/sun.font.SunFontManager.loadFonts(SunFontManager.java:2946)
        at [email protected]/sun.font.SunFontManager.loadFontFiles(SunFontManager.java:3053)
        at [email protected]/sun.font.SunFontManager.getInstalledFontFamilyNames(SunFontManager.java:3379)
        at [email protected]/sun.java2d.SunGraphicsEnvironment.getAvailableFontFamilyNames(SunGraphicsEnvironment.java:172)
        at [email protected]/sun.java2d.SunGraphicsEnvironment.getAvailableFontFamilyNames(SunGraphicsEnvironment.java:195)
        at [email protected]/sun.java2d.HeadlessGraphicsEnvironment.getAvailableFontFamilyNames(HeadlessGraphicsEnvironment.java:80)
        at net.sourceforge.plantuml.klimt.font.UFont.<clinit>(UFont.java:95)
        at net.sourceforge.plantuml.style.Style.getUFont(Style.java:228)
        at net.sourceforge.plantuml.style.Style.getFontConfiguration(Style.java:241)
        at net.sourceforge.plantuml.style.Style.getFontConfiguration(Style.java:237)
        at net.sourceforge.plantuml.skin.AbstractTextualComponent.<init>(AbstractTextualComponent.java:121)
        at net.sourceforge.plantuml.skin.rose.ComponentRoseParticipant.<init>(ComponentRoseParticipant.java:105)
        at net.sourceforge.plantuml.skin.rose.Rose.createComponent(Rose.java:180)
        at net.sourceforge.plantuml.sequencediagram.graphic.DrawableSetInitializer.prepareParticipant(DrawableSetInitializer.java:671)
        at net.sourceforge.plantuml.sequencediagram.graphic.DrawableSetInitializer.createDrawableSet(DrawableSetInitializer.java:176)
        at net.sourceforge.plantuml.sequencediagram.graphic.SequenceDiagramFileMakerPuma2.<init>(SequenceDiagramFileMakerPuma2.java:142)
        at net.sourceforge.plantuml.sequencediagram.SequenceDiagram.getSequenceDiagramPngMaker(SequenceDiagram.java:318)
        at net.sourceforge.plantuml.sequencediagram.SequenceDiagram.getNbImages(SequenceDiagram.java:511)
        at net.sourceforge.plantuml.PSystemUtils.exportDiagramsSequence(PSystemUtils.java:177)
        at net.sourceforge.plantuml.PSystemUtils.exportDiagrams(PSystemUtils.java:124)
        at net.sourceforge.plantuml.SourceFileReaderAbstract.getGeneratedImages(SourceFileReaderAbstract.java:226)
        at net.sourceforge.plantuml.Run.manageFileInternal(Run.java:562)
        at net.sourceforge.plantuml.Run.processArgs(Run.java:456)
        at net.sourceforge.plantuml.Run.manageAllFiles(Run.java:423)
        at net.sourceforge.plantuml.Run.main(Run.java:258)
        at [email protected]/java.lang.invoke.LambdaForm$DMH/sa346b79c.invokeStaticInit(LambdaForm$DMH)
javax.imageio.IIOException: Caught exception during read:
        at [email protected]/com.sun.imageio.plugins.png.PNGImageReader.read(PNGImageReader.java:1851)
        at [email protected]/javax.imageio.ImageIO.read(ImageIO.java:1466)
        at [email protected]/javax.imageio.ImageIO.read(ImageIO.java:1363)
        at net.sourceforge.plantuml.security.SImageIO.read(SImageIO.java:112)
        at net.sourceforge.plantuml.fun.IconLoader.getIconSlow(IconLoader.java:131)
        at net.sourceforge.plantuml.fun.IconLoader.getIcon(IconLoader.java:117)
        at net.sourceforge.plantuml.fun.IconLoader.getRandom(IconLoader.java:96)
        at net.sourceforge.plantuml.UmlDiagram.exportDiagramError(UmlDiagram.java:225)
        at net.sourceforge.plantuml.UmlDiagram.exportDiagramError(UmlDiagram.java:195)
        at net.sourceforge.plantuml.UmlDiagram.exportDiagramNow(UmlDiagram.java:188)
        at net.sourceforge.plantuml.AbstractPSystem.exportDiagram(AbstractPSystem.java:251)
        at net.sourceforge.plantuml.PSystemUtils.exportDiagramsSequence(PSystemUtils.java:187)
        at net.sourceforge.plantuml.PSystemUtils.exportDiagrams(PSystemUtils.java:124)
        at net.sourceforge.plantuml.SourceFileReaderAbstract.getGeneratedImages(SourceFileReaderAbstract.java:226)
        at net.sourceforge.plantuml.Run.manageFileInternal(Run.java:562)
        at net.sourceforge.plantuml.Run.processArgs(Run.java:456)
        at net.sourceforge.plantuml.Run.manageAllFiles(Run.java:423)
        at net.sourceforge.plantuml.Run.main(Run.java:258)
        at [email protected]/java.lang.invoke.LambdaForm$DMH/sa346b79c.invokeStaticInit(LambdaForm$DMH)
Caused by: java.lang.NoSuchFieldError: sun.awt.image.ByteComponentRaster.data
        at org.graalvm.nativeimage.builder/com.oracle.svm.core.jni.functions.JNIFunctions$Support.getFieldID(JNIFunctions.java:1357)
        at org.graalvm.nativeimage.builder/com.oracle.svm.core.jni.functions.JNIFunctions.GetFieldID(JNIFunctions.java:449)
        at [email protected]/sun.awt.image.ByteComponentRaster.initIDs(Native Method)
        at [email protected]/sun.awt.image.ByteComponentRaster.<clinit>(ByteComponentRaster.java:83)
        at [email protected]/java.lang.Class.ensureInitialized(DynamicHub.java:604)
        at [email protected]/java.awt.image.Raster.createWritableRaster(Raster.java:1162)
        at [email protected]/java.awt.image.Raster.createWritableRaster(Raster.java:1121)
        at [email protected]/javax.imageio.ImageTypeSpecifier.createBufferedImage(ImageTypeSpecifier.java:1066)
        at [email protected]/javax.imageio.ImageReader.getDestination(ImageReader.java:2877)
        at [email protected]/com.sun.imageio.plugins.png.PNGImageReader.readImage(PNGImageReader.java:1485)
        at [email protected]/com.sun.imageio.plugins.png.PNGImageReader.read(PNGImageReader.java:1844)
        ... 18 more
Exception in thread "main" java.lang.NoClassDefFoundError: Could not initialize class net.sourceforge.plantuml.klimt.font.UFont
        at net.sourceforge.plantuml.klimt.shape.GraphicStrings.sansSerif12(GraphicStrings.java:155)
        at net.sourceforge.plantuml.klimt.shape.GraphicStrings.createBlackOnWhite(GraphicStrings.java:150)
        at net.sourceforge.plantuml.UmlDiagram.exportDiagramError(UmlDiagram.java:225)
        at net.sourceforge.plantuml.UmlDiagram.exportDiagramError(UmlDiagram.java:195)
        at net.sourceforge.plantuml.UmlDiagram.exportDiagramNow(UmlDiagram.java:188)
        at net.sourceforge.plantuml.AbstractPSystem.exportDiagram(AbstractPSystem.java:251)
        at net.sourceforge.plantuml.PSystemUtils.exportDiagramsSequence(PSystemUtils.java:187)
        at net.sourceforge.plantuml.PSystemUtils.exportDiagrams(PSystemUtils.java:124)
        at net.sourceforge.plantuml.SourceFileReaderAbstract.getGeneratedImages(SourceFileReaderAbstract.java:226)
        at net.sourceforge.plantuml.Run.manageFileInternal(Run.java:562)
        at net.sourceforge.plantuml.Run.processArgs(Run.java:456)
        at net.sourceforge.plantuml.Run.manageAllFiles(Run.java:423)
        at net.sourceforge.plantuml.Run.main(Run.java:258)
        at [email protected]/java.lang.invoke.LambdaForm$DMH/sa346b79c.invokeStaticInit(LambdaForm$DMH)

albert-github avatar Mar 02 '25 12:03 albert-github

@asm0dey Did you get any feedback from your team?

albert-github avatar Mar 30 '25 11:03 albert-github

@albert-github sorry, completely slipped my mind :( On it right now

asm0dey avatar Apr 19 '25 09:04 asm0dey

Wrote them, don't have any answer yet (explainable - easter holidays here in Europe) Pasha Finkelshteyn Developer Advocate [image: Logo] https://bell-sw.com/ Mobile: +49 1525 981-7123 Email: @.*** bell-sw.com [image: facebook icon] https://www.facebook.com/asm0dey [image: twitter icon] https://twitter.com/asm0di0 [image: linkedin icon] https://www.linkedin.com/in/asm0dey [image: instagram icon] https://www.instagram.com/asm0dey [image: telegram icon] https://t.me/asm0dey

On Sun, 30 Mar 2025 at 13:50, albert-github @.***> wrote:

@asm0dey https://github.com/asm0dey Did you get any feedback from your team?

— Reply to this email directly, view it on GitHub https://github.com/plantuml/plantuml/issues/1344#issuecomment-2764521384, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJ4XAWYRZ5AUX6VIGYNUG32W7LBVAVCNFSM6AAAAABNHNWUIOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDONRUGUZDCMZYGQ . You are receiving this because you were mentioned.Message ID: @.***> [image: albert-github]albert-github left a comment (plantuml/plantuml#1344) https://github.com/plantuml/plantuml/issues/1344#issuecomment-2764521384

@asm0dey https://github.com/asm0dey Did you get any feedback from your team?

— Reply to this email directly, view it on GitHub https://github.com/plantuml/plantuml/issues/1344#issuecomment-2764521384, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJ4XAWYRZ5AUX6VIGYNUG32W7LBVAVCNFSM6AAAAABNHNWUIOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDONRUGUZDCMZYGQ . You are receiving this because you were mentioned.Message ID: @.***>

asm0dey avatar Apr 19 '25 12:04 asm0dey

@asm0dey any progress yet?

albert-github avatar May 30 '25 08:05 albert-github

Please note that I had to add -march=compatibility option otherwise GraalVM will use "recent" CPU operations that are not supported on "old "CPU.

Reference: https://www.graalvm.org/latest/reference-manual/native-image/overview/Options/#build-options

If you are targeting a large audience, I think it makes sense to use this option. One downside is that the binary size will increase a bit.

ggrossetie avatar May 31 '25 09:05 ggrossetie

@asm0dey is this still on the radar?

fliiiix avatar Jul 25 '25 08:07 fliiiix

It's still there, but the team still didn't have time to look at it. However it's on our internal gitlab and I'm constantly monitoring it.

On Fri, 25 Jul 2025, 10:03 Felix, @.***> wrote:

fliiiix left a comment (plantuml/plantuml#1344) https://github.com/plantuml/plantuml/issues/1344#issuecomment-3116813742

@asm0dey https://github.com/asm0dey is this still on the radar?

— Reply to this email directly, view it on GitHub https://github.com/plantuml/plantuml/issues/1344#issuecomment-3116813742, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJ4XAXYBBGXDMY3DQG4DQL3KHQDVAVCNFSM6AAAAABNHNWUIOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTCMJWHAYTGNZUGI . You are receiving this because you were mentioned.Message ID: @.***>

asm0dey avatar Jul 25 '25 08:07 asm0dey

I was looking into this again and by the lack of updates i assume this didn't had prio yet? @asm0dey And I was assuming there is a native image release with the normal release but that does not seem to be the case the latest native image release seems to be 1.2025.04 while the latest release seems to be v1.2025.10. On which schedule are the native images released?

fliiiix avatar Nov 13 '25 08:11 fliiiix

Hi folks! Sadly no, still no prio. They are released (at least so far) on the same schedule as regular Java - quarterly. No-one knows how will it be in the future - there are changes in the GraalVM team and structure as you know.

asm0dey avatar Nov 13 '25 10:11 asm0dey

Recently, we started bringing the native compilation back online. For now, only Windows and Linux x64 are available. Please let us know if this works for you.

https://github.com/plantuml/plantuml/releases/tag/snapshot-native

arnaudroques avatar Nov 14 '25 12:11 arnaudroques

@arnaudroques

Running windows 11.

Dowloaded the new zip file, unpacked it and ran:

plantuml-headless.exe -version

which resulted in:

PlantUML version 1.2025.11beta3 (Unknown compile time)
(GPLv2 source distribution)
Java Runtime: GraalVM Runtime Environment
JVM: Substrate VM
Default Encoding: UTF-8
Language: null
Country: null

PLANTUML_LIMIT_SIZE: 4096

java.io.IOException: Brotli stream decoding failed
        at net.sourceforge.plantuml.brotli.BrotliInputStream.read(BrotliInputStream.java:216)
        at net.sourceforge.plantuml.brotli.BrotliInputStream.read(BrotliInputStream.java:170)
        at net.sourceforge.plantuml.windowsdot.WindowsDotArchive.readByte(WindowsDotArchive.java:122)
        at net.sourceforge.plantuml.windowsdot.WindowsDotArchive.readString(WindowsDotArchive.java:105)
        at net.sourceforge.plantuml.windowsdot.WindowsDotArchive.extract(WindowsDotArchive.java:129)
        at net.sourceforge.plantuml.windowsdot.WindowsDotArchive.getWindowsExeLite(WindowsDotArchive.java:165)
        at net.sourceforge.plantuml.dot.GraphvizWindowsLite.specificDotExe(GraphvizWindowsLite.java:93)
        at net.sourceforge.plantuml.dot.AbstractGraphviz.searchDotExe(AbstractGraphviz.java:126)
        at net.sourceforge.plantuml.dot.AbstractGraphviz.<init>(AbstractGraphviz.java:111)
        at net.sourceforge.plantuml.dot.GraphvizWindowsLite.<init>(GraphvizWindowsLite.java:104)
        at net.sourceforge.plantuml.dot.GraphvizRuntimeEnvironment.create(GraphvizRuntimeEnvironment.java:186)
        at net.sourceforge.plantuml.dot.GraphvizRuntimeEnvironment.getDotExe(GraphvizRuntimeEnvironment.java:228)
        at net.sourceforge.plantuml.dot.GraphvizUtils.addDotStatus(GraphvizUtils.java:148)
        at net.sourceforge.plantuml.cli.OptionPrint.printVersion(OptionPrint.java:126)
        at net.sourceforge.plantuml.Run.main(Run.java:173)
        at [email protected]/java.lang.invoke.LambdaForm$DMH/sa346b79c.invokeStaticInit(LambdaForm$DMH)
Caused by: net.sourceforge.plantuml.brotli.BrotliRuntimeException: brotli dictionary is not set
        at net.sourceforge.plantuml.brotli.Dictionary.getData(Dictionary.java:119)
        at net.sourceforge.plantuml.brotli.Decode.decompress(Decode.java:970)
        at net.sourceforge.plantuml.brotli.BrotliInputStream.read(BrotliInputStream.java:210)
        ... 15 more
Dot version: dot - graphviz version 2.44.1 (20200629.0846)
Installation seems OK. File generation OK

created in the same directory the file aa.pu:

@startuml
Alice -> Bob : Hello
@enduml

running:

plantuml-headless.exe -tpng -o. aa.pu

resulted in:

java.lang.NoSuchFieldError: sun.awt.image.ByteComponentRaster.data
        at org.graalvm.nativeimage.builder/com.oracle.svm.core.jni.functions.JNIFunctions$Support.getFieldID(JNIFunctions.java:1864)
        at org.graalvm.nativeimage.builder/com.oracle.svm.core.jni.functions.JNIFunctions.GetFieldID(JNIFunctions.java:461)
        at [email protected]/sun.awt.image.ByteComponentRaster.initIDs(Native Method)
        at [email protected]/sun.awt.image.ByteComponentRaster.<clinit>(ByteComponentRaster.java:83)
        at [email protected]/java.lang.Class.ensureInitialized(DynamicHub.java:604)
        at [email protected]/java.awt.image.Raster.createInterleavedRaster(Raster.java:741)
        at [email protected]/java.awt.image.Raster.createInterleavedRaster(Raster.java:322)
        at [email protected]/java.awt.image.Raster.createInterleavedRaster(Raster.java:225)
        at [email protected]/java.awt.image.BufferedImage.<init>(BufferedImage.java:560)
        at net.sourceforge.plantuml.png.quant.Quantify555.buildIndexedImageFromCubes(Quantify555.java:240)
        at net.sourceforge.plantuml.png.quant.Quantify555.packMeIfPossible(Quantify555.java:200)
        at net.sourceforge.plantuml.png.PngIO.write(PngIO.java:119)
        at net.sourceforge.plantuml.klimt.drawing.g2d.UGraphicG2d.writeToStream(UGraphicG2d.java:249)
        at net.atmp.ImageBuilder.writeImageInternal(ImageBuilder.java:313)
        at net.atmp.ImageBuilder.write(ImageBuilder.java:275)
        at net.sourceforge.plantuml.sequencediagram.graphic.SequenceDiagramFileMakerPuma2.createOne(SequenceDiagramFileMakerPuma2.java:187)
        at net.sourceforge.plantuml.sequencediagram.SequenceDiagram.exportDiagramInternal(SequenceDiagram.java:353)
        at net.sourceforge.plantuml.UmlDiagram.exportDiagramNow(UmlDiagram.java:154)
        at net.sourceforge.plantuml.AbstractPSystem.exportDiagram(AbstractPSystem.java:262)
        at net.sourceforge.plantuml.PSystemUtils.exportDiagramsSequence(PSystemUtils.java:189)
        at net.sourceforge.plantuml.PSystemUtils.exportDiagrams(PSystemUtils.java:126)
        at net.sourceforge.plantuml.SourceFileReaderAbstract.getGeneratedImages(SourceFileReaderAbstract.java:234)
        at net.sourceforge.plantuml.Run.manageFileInternal(Run.java:380)
        at net.sourceforge.plantuml.Run.lambda$processInputsInParallel$12(Run.java:337)
        at net.sourceforge.plantuml.Run.lambda$processInParallel$14(Run.java:353)
        at [email protected]/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:572)
        at [email protected]/java.util.concurrent.FutureTask.run(FutureTask.java:317)
        at [email protected]/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
        at [email protected]/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
        at [email protected]/java.lang.Thread.runWith(Thread.java:1596)
        at [email protected]/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)
javax.imageio.IIOException: Caught exception during read:
        at [email protected]/com.sun.imageio.plugins.png.PNGImageReader.read(PNGImageReader.java:1852)
        at [email protected]/javax.imageio.ImageIO.read(ImageIO.java:1466)
        at [email protected]/javax.imageio.ImageIO.read(ImageIO.java:1363)
        at net.sourceforge.plantuml.security.SImageIO.read(SImageIO.java:111)
        at net.sourceforge.plantuml.fun.IconLoader.getIconSlow(IconLoader.java:131)
        at net.sourceforge.plantuml.fun.IconLoader.getIcon(IconLoader.java:117)
        at net.sourceforge.plantuml.fun.IconLoader.getRandom(IconLoader.java:96)
        at net.sourceforge.plantuml.crash.CrashImage.<init>(CrashImage.java:103)
        at net.sourceforge.plantuml.crash.CrashReportHandler.exportDiagramError(CrashReportHandler.java:103)
        at net.sourceforge.plantuml.UmlDiagram.exportDiagramNow(UmlDiagram.java:201)
        at net.sourceforge.plantuml.AbstractPSystem.exportDiagram(AbstractPSystem.java:262)
        at net.sourceforge.plantuml.PSystemUtils.exportDiagramsSequence(PSystemUtils.java:189)
        at net.sourceforge.plantuml.PSystemUtils.exportDiagrams(PSystemUtils.java:126)
        at net.sourceforge.plantuml.SourceFileReaderAbstract.getGeneratedImages(SourceFileReaderAbstract.java:234)
        at net.sourceforge.plantuml.Run.manageFileInternal(Run.java:380)
        at net.sourceforge.plantuml.Run.lambda$processInputsInParallel$12(Run.java:337)
        at net.sourceforge.plantuml.Run.lambda$processInParallel$14(Run.java:353)
        at [email protected]/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:572)
        at [email protected]/java.util.concurrent.FutureTask.run(FutureTask.java:317)
        at [email protected]/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
        at [email protected]/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
        at [email protected]/java.lang.Thread.runWith(Thread.java:1596)
        at [email protected]/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)
Caused by: java.lang.NoSuchFieldError: sun.awt.image.BytePackedRaster.data
        at org.graalvm.nativeimage.builder/com.oracle.svm.core.jni.functions.JNIFunctions$Support.getFieldID(JNIFunctions.java:1864)
        at org.graalvm.nativeimage.builder/com.oracle.svm.core.jni.functions.JNIFunctions.GetFieldID(JNIFunctions.java:461)
        at [email protected]/sun.awt.image.BytePackedRaster.initIDs(Native Method)
        at [email protected]/sun.awt.image.BytePackedRaster.<clinit>(BytePackedRaster.java:81)
        at [email protected]/java.awt.image.Raster.createWritableRaster(Raster.java:1202)
        at [email protected]/java.awt.image.Raster.createWritableRaster(Raster.java:1121)
        at [email protected]/javax.imageio.ImageTypeSpecifier.createBufferedImage(ImageTypeSpecifier.java:1066)
        at [email protected]/javax.imageio.ImageReader.getDestination(ImageReader.java:2877)
        at [email protected]/com.sun.imageio.plugins.png.PNGImageReader.readImage(PNGImageReader.java:1486)
        at [email protected]/com.sun.imageio.plugins.png.PNGImageReader.read(PNGImageReader.java:1845)
        ... 24 more

furthermore an empty file aa.png was created.

Also the help information is a bit strange:

plantuml - generate diagrams from plain text

Usage:
  java -jar plantuml.jar [options] [file|dir]...
  java -jar plantuml.jar [options] --gui

Description:
  Process PlantUML sources from files, directories (optionally recursive), or stdin (-pipe).

Wildcards (for files/dirs):
  *   any characters except '/' and '\'
  ?   exactly one character except '/' and '\'
  **  any characters across directories (recursive)
  Tip: quote patterns to avoid shell expansion (e.g., "**/*.puml").

General:

General:


Examples:
  # Process all .puml recursively
  java -jar plantuml.jar "**/*.puml"

  # Check syntax only (CI)
  java -jar plantuml.jar --check-syntax src/diagrams

  # Read from stdin and write to stdout (SVG)
  cat diagram.puml | java -jar plantuml.jar --svg -pipe > out.svg

  # Encode a sprite from an image
  java -jar plantuml.jar --sprite 16z myicon.png

  # Use a define
  java -jar plantuml.jar -DAUTHOR=John diagram.puml

  # Change output directory
  java -jar plantuml.jar --format svg --output-dir out diagrams/

Exit codes:
  0   Success
  >0  Error (syntax error or processing failure)

See also:
  java -jar plantuml.jar --help-more
  Documentation: https://plantuml.com

Repeated tests with the full version

  • plantuml-full.exe -version crashed in the same way
  • plantuml-full.exe -help similar strange information
  • plantuml-full.exe -tpng -o. aa.pu looks like to give correct results on the small example

albert-github avatar Nov 14 '25 17:11 albert-github

@arnaudroques When running:

plantuml-full.exe --gui

I get:

java.lang.UnsupportedOperationException
        at [email protected]/java.util.Collections$UnmodifiableCollection.add(Collections.java:1092)
        at net.sourceforge.plantuml.swing.DirWatcher2$1.call(DirWatcher2.java:138)
        at net.sourceforge.plantuml.swing.DirWatcher2$1.call(DirWatcher2.java:132)
        at [email protected]/java.util.concurrent.FutureTask.run(FutureTask.java:317)
        at [email protected]/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
        at [email protected]/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
        at [email protected]/java.lang.Thread.runWith(Thread.java:1596)
        at [email protected]/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)

but a window appears with the gui.

albert-github avatar Nov 15 '25 10:11 albert-github

Did some testing with: Version ~v1.2025.11beta5 of the 2025-11-22 at 16:22:12 (UTC)"

Full version

  • -v OK, -version crashed (after giving the version info)
  • -h same as before (help about jar)
  • -gui window appear but also stack trace / error message
  • giving pu file looks OK

Some questions:

  • where to find the correct help information
  • where to find the documentation? I found at https://plantuml.com the PDF guide but when I wanted to look at it it requested me to look at a short video first (which I refuse to do!) before progressing and also there is an incredible amount of intrusive advertisements (completely maddening me) at those pages. It is unclear what are really plantuml links or advertisement links and therefore unusable
  • what is the difference between the full version and the headless version?

albert-github avatar Nov 22 '25 17:11 albert-github