解决CentOS 中部署JasperReport时出错的问题。错误:net.sf.jasperreports.engine.util.JRFontNotFoundException: Font '宋体' is not available to the JVM.
2012-11-24 11:08
731 查看
CentOS 中部署JasperReport时出错:
net.sf.jasperreports.engine.util.JRFontNotFoundException: Font '宋体' is not available to the JVM. See the Javadoc for more details.
原因:操作系统默认语言是英文版的。修改为中文并拷贝windows的字体到linux系统中并应用,停止Tomcat等Web服务器,删除缓存(Tomcat中为tomcat目录下的work目录)即可。
方法:
修改系统默认语言:
vim /etc/sysconfig/i18n
内容:
LANG="en_US.UTF-8"
拷贝字体:
将c:\windows\Fonts(从网上下载simsun.ttf,windows中自带的宋体已经不叫这个名字le)下
的字体拷贝到 /usr/share/fonts/chinese下面(我的是CentOS6,fonts目录下面我自己创建的chinese目录)
依次执行下列命令 cd /usr/share/fonts/chinese
mkfontscale mkfontdir fc-cache
进入tomcat目录,停止tomcat服务,删除work目录。
重启系统:reboot
测试。OK!
经测试,以上方法不能永远解决问题。
以下方法方便快捷的解决了我的问题:
解决方法:
1、把需要用到的字体(可以直接拷贝windows系统的C:\WINDOWS\Fonts 下的相关字体)拷贝当前项目的classpath下,一般为classes目录下
2、在classpath里添加 jasperreports.properties 属性文件
文件内容为:
net.sf.jasperreports.awt.ignore.missing.font=true
即可解决
net.sf.jasperreports.engine.util.JRFontNotFoundException: Font '宋体' is not available to the JVM. See the Javadoc for more details.
原因:操作系统默认语言是英文版的。修改为中文并拷贝windows的字体到linux系统中并应用,停止Tomcat等Web服务器,删除缓存(Tomcat中为tomcat目录下的work目录)即可。
方法:
修改系统默认语言:
vim /etc/sysconfig/i18n
内容:
LANG="en_US.UTF-8"
拷贝字体:
将c:\windows\Fonts(从网上下载simsun.ttf,windows中自带的宋体已经不叫这个名字le)下
的字体拷贝到 /usr/share/fonts/chinese下面(我的是CentOS6,fonts目录下面我自己创建的chinese目录)
依次执行下列命令 cd /usr/share/fonts/chinese
mkfontscale mkfontdir fc-cache
进入tomcat目录,停止tomcat服务,删除work目录。
重启系统:reboot
测试。OK!
经测试,以上方法不能永远解决问题。
以下方法方便快捷的解决了我的问题:
解决方法:
1、把需要用到的字体(可以直接拷贝windows系统的C:\WINDOWS\Fonts 下的相关字体)拷贝当前项目的classpath下,一般为classes目录下
2、在classpath里添加 jasperreports.properties 属性文件
文件内容为:
net.sf.jasperreports.awt.ignore.missing.font=true
即可解决
相关文章推荐
- 解决CentOS 中部署JasperReport时出错的问题。错误:net.sf.jasperreports.engine.util.JRFontNotFoundException: Font '宋体
- net.sf.jasperreports.engine.util.JRFontNotFoundException: Font "黑体" is not available to the JVM. See
- 解决Linux下部署使用JasperReport的项目的错误:net.sf.jasperreports.engine.util.JRFontNotFoundException: Font '宋体' i
- net.sf.jasperreports.engine.util.JRFontNotFoundException: Font ‘黑体’ is not available to the JVM
- Linux环境下部署jasperreport出现net.sf.jasperreports.engine.util.JRFontNotFoundException
- Linux环境下部署jasperreport出现net.sf.jasperreports.engine.util.JRFontNotFoundException
- 抛出 net.sf.jasperreports.engine.JRException: Resource not found at: xxx.jasper 异常的解决办法
- iReport 在Linux上运行出错:Font 'Arial' is not available to the JVM
- net.sf.jasperreports.engine.JRException: Error retrieving field value from bean :
- net.sf.jasperreports.engine.JRException: Error retrieving field value from bean :
- 解决jasperreport pdf导出错误Could not load the following font问题
- 解决Font 'STSong-light' is not available to the JVM.
- net.sf.jasperreports.engine.JRException: Error retrieving field value from bean
- 解决Font 'STSong-light' is not available to the JVM.
- mongodb 安装时出错 the defualt storage engine "wiredTiger" is not available 问题解决
- Windows服务部署问题,The source was not found错误的解决方法
- Report compiler class not found : net.sf.jasperreports.compilers.JRGroovyCompiler
- WAS 报错 Font '宋体' is not available to the JVM
- 解决文件无法上传的问题,错误信息:System.IO.DirectoryNotFoundException: Could not find a part of the path.
- SharpPcap在CentOS 64 Mono环境System.EntryPointNotFoundException错误的解决方法