Skip to content
Advertisement

Cannot load font in JRE 8

I cannot load a font from an S3 Inputstream in JRE 8. I do not have issue if a system is installed with JRE 7, JDK 7, or even JDK 8.

JavaScript

The error that I got is

JavaScript

I tried to load the inputstream to a temp file, but it does not help. I also tried to load a font directly from a local file, but I got a different error with getting font metadata. Here is the error log.

JavaScript

So, this is not a problem with inputstream, but rather with the loading of the font itself in JRE 8.

This seems like a bug in JRE 8 Font.

I am loading a font to use to draw a string in a picture. My code is run in a Docker container using images java:7-jre (ok), java:7-jdk (ok), java:8-jre (fail), java:8-jdk (ok).

Advertisement

Answer

It turns out that this is a problem with the openjdk-8-jre-headless installation. This is the installation in the Docker image for java 8 JRE. I simply install openjdk-8-jre (without headless) and the problem goes away.

If you look at the error log, the loading of the font require awt X11, which is missing from headless version of JRE.

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement