我无法在Mac OS上使用带有OpenJDK 8的PlantUML。我从适用于macOS的AdoptOpenJDK网站下载了1.8.0u192版本:
$ java -version
openjdk version "1.8.0_192"
OpenJDK Runtime Environment (AdoptOpenJDK)(build 1.8.0_192-b12)
OpenJDK 64-Bit Server VM (AdoptOpenJDK)(build 25.192-b12, mixed mode)
如果我尝试使用PlantUML处理一个简单的图,则会收到以下错误消息:
$ java -jar plantuml.1.2018.14.jar example.puml
Exception in thread "main" java.lang.UnsatisfiedLinkError: /private/tmp/jdk8u192-b12/Contents/Home/jre/lib/libfontmanager.dylib: dlopen(/private/tmp/jdk8u192-b12/Contents/Home/jre/lib/libfontmanager.dylib, 1): Library not loaded: @rpath/libfreetype.6.dylib
Referenced from: /private/tmp/jdk8u192-b12/Contents/Home/jre/lib/libfontmanager.dylib
Reason: image not found
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1941)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1845)
at java.lang.Runtime.loadLibrary0(Runtime.java:870)
at java.lang.System.loadLibrary(System.java:1122)
at sun.font.FontManagerNativeLibrary$1.run(FontManagerNativeLibrary.java:61)
at java.security.AccessController.doPrivileged(Native Method)
at sun.font.FontManagerNativeLibrary.<clinit>(FontManagerNativeLibrary.java:32)
at sun.font.SunFontManager$1.run(SunFontManager.java:339)
at java.security.AccessController.doPrivileged(Native Method)
at sun.font.SunFontManager.<clinit>(SunFontManager.java:335)
at sun.font.FontDesignMetrics.getMetrics(FontDesignMetrics.java:264)
at sun.java2d.SunGraphics2D.getFontMetrics(SunGraphics2D.java:863)
at net.sourceforge.plantuml.Run.forceOpenJdkResourceLoad(Run.java:234)
at net.sourceforge.plantuml.Run.main(Run.java:143)
该错误与图表无关。我什至无法处理项目主页上最简单的PlantUML图:
@startuml
Bob -> Alice : hello
@enduml
很明显,缺少FreeType。但是我该如何解决呢?