An error occurred while deploying jasperreport in centos:
Net. SF. jasperreports. Engine. util. jrfontnotfoundexception: font 'body' is not available to the JVM. See the javadoc for more details.
Cause: the default Operating System language is English. Modify it to Chinese and copy the font of windows to the Linux system and apply it. Stop Tomcat and other web servers and delete the cache (Tomcat is the work directory under the Tomcat directory.
Method:
Modify the default system language:
Vim/etc/sysconfig/i18n
Content:
Lang = "en_US.UTF-8"
Copy Font:
Run "C: \ WINDOWS \ fonts" (download simsun. TTF from the Internet. The name "Le" is not included in the self-contained "Le "file in Windows ).
Copy the font to/usr/share/fonts/Chinese (My is centos6, and my own Chinese directory under the fonts directory)
Execute the following commands in sequence
CD/usr/share/fonts/Chinese
Mkfontscale
Mkfontdir
FC-Cache
Go to the Tomcat directory, stop the Tomcat service, and delete the work directory.
Restart the system: reboot
Test. OK!
After testing, the above method cannot solve the problem forever.
The following methods help solve my problem conveniently and quickly:
Solution:
1. Copy the required font (c: \ windows \ fonts can be copied directly) to the classpath of the current project, which is generally under the classes directory.
2. Add the jasperreports. properties attribute file to classpath.
File Content:
Net. SF. jasperreports. AWT. Ignore. Missing. font = true
You can solve this problem.