Cannot load font in JRE 8

坚强是说给别人听的谎言 提交于 2019-11-29 04:15:02

I met with the same error in openjdk:8-jre-alpine. Switching to openjdk:8-jre also helped. (apt-get line seems not necessary)

--- FROM openjdk:8-jre-alpine
+++ FROM openjdk:8-jre
+++ RUN apt-get install -y libfontconfig

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.

On CentOS headless JRE is missing the fontconfig dependency:

yum install fontconfig

Also one might need to install at least one font (dejavu, liberation, etc).

We also got that error when using tomcat:8.0.38-jre8-alpine. That image is missing the fontconfig. Instead of switching to a different image you could also install the ttf-dejavu package.

apk add --update ttf-dejavu

For alpine and openjdk : Use RUN apk --update add fontconfig ttf-dejavu Worked for me.

For me this resolved issue:

apt-get install -y libfontconfig1
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!