How to Set up the Java Chinese environment in Linux

Source: Internet
Author: User
How to Set up the Java Chinese environment in Linux-general Linux technology-Linux programming and kernel information. For details, refer to the following section. When using Java to develop an application in Linux, the Chinese display is abnormal, and the Chinese character in the application in the window is displayed as a string of squares. This is mainly because the font settings are incorrect. In the configuration file that comes with JDK, the specified Chinese font does not exist, leading to incorrect display. This article takes Mandrake Linux 8.2 and JDK 1.4.1 as examples to briefly introduce how to set up the Java Chinese environment in Linux. For other Linux systems or JDK versions, see this article.

First, check whether your/usr/share/fonts/ttf/gb directory contains the Chinese font gbsn00lp. ttf. If not, use song. ttf in the Windows Font directory. Copy the font file to jre/lib/fonts in the Java installation directory.

Second, modify the jre/lib/fonts. dir file in the Java installation directory, change 72 in the first line to 73, and then add the following content:

Gbsn00lp. ttf-Arphic Technology Co.-ar pl SungtiL GB-medium-r-normal -- 0-0-0-0-c-0-gb2312.1980-0

Note: If you use song. ttf, change gbsn00lp. ttf in the header to song. ttf.

Third, copy the font. properties. zh. Turbo file to font. properties. zh In the jre/lib directory under the Java installation directory. Then modify font. properties. zh. Put all of the files:

-Replace the-tlc-song-medium-r-normal -- *-% d-*-c-*-gbk-0:
-Arphic Technology Co.-ar pl SungtiL GB-medium-r-normal -- 0-0-0-0-c-0-gb2312.1980-0

Fourth, use the demo program SwingSet2 that comes with JDK to test. If the Chinese menu is displayed, the setting is successful.

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.