解決 Font '宋體' is not available to the JVM
CentOS 中部署JasperReport時(shí)出錯(cuò):
net.sf.jasperreports.engine.util.JRFontNotFoundException: Font '宋體' is not available to the JVM. See the Javadoc for more details.

原因:操作系統(tǒng)默認(rèn)語言是英文版的。修改為中文并拷貝windows的字體到linux系統(tǒng)中并應(yīng)用,重啟應(yīng)用服務(wù)器即可。
解決方法:
1、把需要用到的字體(可以直接拷貝windows系統(tǒng)的C:\WINDOWS\Fonts 下的相關(guān)字體)拷貝當(dāng)前項(xiàng)目的classpath下,一般為classes目錄下
2、在classpath里添加 jasperreports.properties 屬性文件
文件內(nèi)容為:net.sf.jasperreports.awt.ignore.missing.font=true
3、重啟應(yīng)用服務(wù)器
如若轉(zhuǎn)載,請(qǐng)注明出處:開源字節(jié) ? https://sourcebyte.vip/article/303.html
標(biāo)簽:開源