Hello, (please let me know in case I picked the wrong list.)
Since OpenJDK does not ship Default *.ttf font files the change that a JRE is installed in a way that no System Fonts can be found is quite high. In OpenJDK8 it is a bit unfortunate that in this situation even for the headless graphics context that you can can a Java.lang.Error: I wonder if this is intentional. How About returnign an empty Array or Maybe a RntimeException instead? In my case by upgrading from Oracle JRE to Open JDK (in my case Azul) a perfectly fine working Installation is not aborting. The JasperReports component used is failing does not even need the System Fonts (which I will report to them seperately). For Zulu it is enough to install Dejavu Fonts in System Directory or copy them to JRE/lib/fonts/, but I have also seen OpenJDK builds which seem to use fontmanager libraries instead of fixed file path. Here I guess the dependency on System config is even higher. I tested on a minimal System with no X11: > ls /usr/share/fonts > cat /etc/centos-release CentOS Linux release 7.3.1611 (Core) And my test program (below) Returns for Java 8: > zulu8*x64/bin/java -cp . FontTest Are we headless? true g = sun.java2d.HeadlessGraphicsEnvironment headless: true Exception in thread "main" java.lang.Error: Probable fatal error:No fonts found. at sun.font.SunFontManager.getDefaultPhysicalFont(SunFontManager.java:1236) at sun.font.SunFontManager.initialiseDeferredFont(SunFontManager.java:1100) … at sun.font.SunFontManager.getDefaultPhysicalFont(SunFontManager.java:1220) at sun.font.SunFontManager.initialiseDeferredFont(SunFontManager.java:1100) at sun.font.SunFontManager.initialiseDeferredFonts(SunFontManager.java:927) at sun.font.SunFontManager.loadFonts(SunFontManager.java:3302) at sun.awt.X11FontManager.loadFonts(X11FontManager.java:466) at sun.font.SunFontManager.loadFontFiles(SunFontManager.java:3429) at sun.font.SunFontManager.getInstalledFontFamilyNames(SunFontManager.java:3766) at sun.java2d.SunGraphicsEnvironment.getAvailableFontFamilyNames(SunGraphicsEnvironment.java:225) at sun.java2d.SunGraphicsEnvironment.getAvailableFontFamilyNames(SunGraphicsEnvironment.java:252) at sun.java2d.HeadlessGraphicsEnvironment.getAvailableFontFamilyNames(HeadlessGraphicsEnvironment.java:94) at FontTest.main(FontTest.java:15) So the error in itself is one topic I wanted to inquire About. However, even worse in OpenJDK 11 the error seems to have degenerated quite a bit, it Looks for me: > zulu11*x64/bin/java -cp . FontTest Are we headless? true g = sun.java2d.HeadlessGraphicsEnvironment headless: true Exception in thread "main" java.lang.InternalError: java.lang.reflect.InvocationTargetException at java.desktop/sun.font.FontManagerFactory$1.run(FontManagerFactory.java:86) at java.base/java.security.AccessController.doPrivileged(Native Method) at java.desktop/sun.font.FontManagerFactory.getInstance(FontManagerFactory.java:74) at java.desktop/sun.java2d.SunGraphicsEnvironment.getFontManagerForSGE(SunGraphicsEnvironment.java:189) at java.desktop/sun.java2d.SunGraphicsEnvironment.getAvailableFontFamilyNames(SunGraphicsEnvironment.java:223) at java.desktop/sun.java2d.SunGraphicsEnvironment.getAvailableFontFamilyNames(SunGraphicsEnvironment.java:251) at java.desktop/sun.java2d.HeadlessGraphicsEnvironment.getAvailableFontFamilyNames(HeadlessGraphicsEnvironment.java:75) at FontTest.main(FontTest.java:15) Caused by: java.lang.reflect.InvocationTargetException at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490) at java.desktop/sun.font.FontManagerFactory$1.run(FontManagerFactory.java:84) ... 7 more Caused by: java.lang.NullPointerException at java.desktop/sun.awt.FontConfiguration.getVersion(FontConfiguration.java:1262) at java.desktop/sun.awt.FontConfiguration.readFontConfigFile(FontConfiguration.java:225) at java.desktop/sun.awt.FontConfiguration.init(FontConfiguration.java:107) at java.desktop/sun.awt.X11FontManager.createFontConfiguration(X11FontManager.java:719) at java.desktop/sun.font.SunFontManager$2.run(SunFontManager.java:367) at java.base/java.security.AccessController.doPrivileged(Native Method) at java.desktop/sun.font.SunFontManager.<init>(SunFontManager.java:312) at java.desktop/sun.awt.FcFontManager.<init>(FcFontManager.java:35) at java.desktop/sun.awt.X11FontManager.<init>(X11FontManager.java:56) ... 12 mor If there is no known issue for that, is it worth to file a Bug for it? (I Need to recreate it with a Oracle OpenJDK binary yet if it is only a fontconfig Problem – but in that case a null check is probably also a good thing?) Gruss Bernd