hutool Excel 匯出 Caused by: java.lang.RuntimeException: Fontconfig head is null, check your fonts or fonts configuration
Caused by: java.lang.RuntimeException: Fontconfig head is null, check your fonts or fonts configuration
at java.desktop/sun.awt.FontConfiguration.getVersion(FontConfiguration.java:1269) ~[na:na]
at java.desktop/sun.awt.FontConfiguration.readFontConfigFile(FontConfiguration.java:224) ~[na:na]
at java.desktop/sun.awt.FontConfiguration.init(FontConfiguration.java:106) ~[na:na]
at java.desktop/sun.awt.X11FontManager.createFontConfiguration(X11FontManager.java:706) ~[na:na]
at java.desktop/sun.font.SunFontManager$2.run(SunFontManager.java:358) ~[na:na]
at java.desktop/sun.font.SunFontManager$2.run(SunFontManager.java:315) ~[na:na]
at java.base/java.security.AccessController.doPrivileged(AccessController.java:318) ~[na:na]
at java.desktop/sun.font.SunFontManager.<init>(SunFontManager.java:315) ~[na:na]
at java.desktop/sun.awt.FcFontManager.<init>(FcFontManager.java:35) ~[na:na]
at java.desktop/sun.awt.X11FontManager.<init>(X11FontManager.java:56) ~[na:na]
... 92 common frames omitted
是因為使用的JDK不支援awt包下的字型
解決方法:
安裝FontConfig元件即可
yum install -y fontconfig
或者將字型檔案放在專案目錄下 載入進來!!