2

I am using windows os, So there is no issue with Font(java.awt) class object creation. but my testing environment is on linux. So on that I am getting NULL POINTER exception.

Cannot load from short array because "sun.awt.FontConfiguration.head" is null

After seacrhing I found that there should be fonts folder in usr/share directory on linux. So someone can please suggest. Do I have to just copy fonts to that directory or there is other way to intsall?

Anup
  • 55
  • 1
  • 6
  • I think that could vary between distros but do you actually need to install it? You could use ```java.awt.Font createFont``` with the font file – g00se Aug 30 '22 at 13:38

1 Answers1

6

For my configuration (java.18/Spring Boot/jib/Docker/ubuntu) I've used this these commands for resolving the issue:

RUN echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections
RUN apt-get update -y
RUN apt-get install -y apt-utils    --no-install-recommends
RUN apt-get install -y libfreetype6 --no-install-recommends
RUN apt-get install -y fontconfig   --no-install-recommends
RUN apt-get install -y fonts-dejavu --no-install-recommends
user3682640
  • 168
  • 1
  • 3
  • another try could be RUN yum -y install freetype RUN yum -y install fontconfig RUN yum -y install harfbuzz RUN yum -y install glibc – Abhaysinh Bhelke May 25 '23 at 13:33