How to display Chinese characters in the JAVAGUI program in Ubuntu as a box

Source: Internet
Author: User
When running the JAVAGUI application in Ubuntu, we found that all Chinese characters in the application are displayed as boxes, and the Chinese characters in some applications in my system are displayed as boxes. Try to remove/etc/fonts/conf. d/49-sansserif.conf is ineffective. Now, Linuxidc has collected and sorted out some solutions: 1. The reason for the box text is that the corresponding font cannot be found in the java Runtime Environment, the method for copying the system font to the java Runtime Environment is as follows:

When running the java gui application in Ubuntu, I found that all Chinese characters in the application are displayed as boxes, and the Chinese characters in some applications in my system are displayed as boxes.

Try to remove/etc/fonts/conf. d/49-sansserif.conf but it does not work.

At present, Linuxidc has collected some solutions:

I,

The reason for the box text is that the corresponding font cannot be found in the java Runtime Environment, so the method to copy the system font to the java Runtime Environment is as follows:

Cd/usr/local/jdk1.5.0 _ 16/jre/lib/fonts/fallback // first enter the font location under your jdk installation path

Sudo cp/usr/share/fonts/truetype/arphic/uming. ttc. // copy the fonts in the system to this directory.

Sudo mkfontdir // set the font to take effect.

Sudo mkfontscale

Now let's take a look. Everything is normal. Haha!

II. The above method may also be used. I have never tried it, but we need to clarify that the cause of this problem is a small BUG in the java configuration file, he mistakenly converted the font suffix "ttc" to "ttf.

The simplest solution is:

Edit configuration file

Sudo gedit/usr/lib/jvm/java-6-sun/jre/lib/fontconfig. properties

Find

Filename.-arphic-ar_pl_shanheisun_uni-medium-r-normal -- *-p-*-iso10646-1 =/usr/share/fonts/truetype/arphic/uming. ttf

Filename.-arphic-ar_pl_uming_uni-medium-r-normal -- *-p-*-iso10646-1 =/usr/share/fonts/truetype/arphic/uming. ttf

You can change the suffix to ttc, because the file in usr/share/fonts is uming. ttc rather than the end of ttf.

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.