Font \ "Microsoft Jas black \" is not available to the JVM. See the Javadoc for more details.

Source: Internet
Author: User
Tags i18n set set

1. Background

When you use Jasperreport to generate a report at work, the error font \ "Microsoft Jas black \" is not available to the JVM appears. See the Javadoc for more details.

2. Analysis

The development environment is WINDOW7, and the problem does not occur. The test environment is Linux and this error occurs. Based on the literal meaning of the error, the initial assumption is that the font is not on the Linux server.

3. Install fonts
    • Install the Chinese fonts on the WINDOW7 to Linux
    • Window7 the font location: C:\Windows\Fonts. As shown below:

    • Copy the Simplified Chinese font to Linux and save the path as:/usr/share/fonts/chinese/truetype. As shown below, the visualizer is WINSCP:

    • To install fonts using the command:

Cd/usr/share/fonts/chinese/truetype

Mkfontscale

Mkfontdir

Fc-cache–fv

    • To view installed fonts:

Fc-list:lang-zh

Note the font selected in the figure Microsoft Jas Black, the left Chinese language, the right side is English expression

4. Re-analysis

If the problem has been solved after restarting the service, congratulations. But I am in fact, very clear Linux has installed the font, but still prompt error. This is probably caused by the environment is not the same problem, so I think of the remote debug debugging, Remote Debugging configuration: http://www.cnblogs.com/zhuqianchang/p/9044699.html

Error location in fontutil.java350 line, check the source code as follows:

According to the source code analysis, first obtain the system font to join the cache, the cache is a set set, and then determine whether the specified font is in the collection. So after debugging in, look at the font in the cache, found that there is no font "Microsoft ya Black", but found the font "Microsoft Yahei". So the problem is clear, although the font is installed, but the Linux system language is English, so the contains method does not match to the font "Microsoft Jas Black", so error.

5. Modify the system language
    • View current language

Echo $LANG

    • Modify language

vi/etc/sysconfig/i18n

English: lang= "en_US. UTF-8 "

English: lang= "ZH_CN. UTF-8 "

    • Immediate effect

source/etc/sysconfig/i18n

6. Restart the service

The system fonts are stored in the cache according to the source code, so the service needs to be restarted. After restarting, the problem is solved smoothly

Font \ "Microsoft Jas black \" is not available to the JVM. See the Javadoc for more details.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.