Anu*_*nup 2 java linux fonts fontconfig java-17
我使用的是 Windows 操作系统,因此 Font(java.awt) 类对象创建没有问题。但我的测试环境是linux。所以我得到了 NULL POINTER 异常。
Cannot load from short array because "sun.awt.FontConfiguration.head" is null
Run Code Online (Sandbox Code Playgroud)
经过搜索,我发现linux上的usr/share目录下应该有fonts文件夹。所以有人可以建议。我是否必须将字体复制到该目录或有其他方法来安装?
小智 8
对于我的配置(java.18/Spring Boot/jib/Docker/ubuntu),我使用这些命令来解决问题:
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
Run Code Online (Sandbox Code Playgroud)