"Java and installanywhere solutions to Chinese problems on Redhat"

Source: Internet
Author: User
Reference: http://blog.csdn.net/jacklondon/archive/2003/05/18/14263.aspx
Quote:
In multiple versions of Sun JDK/JRE, Chinese support for Redhat has been very poor. When the default installation (no configuration file is modified) and the default font (no setfont) is used in Java code, Chinese characters are always hidden. This is rare in windows and Solaris.

There is a saying that sun and RedHat are a competitive relationship. For sun, As long as Java can run on Solaris and windows, other operating systems are redundant; as long as Java runs better on Solaris than on Windows, Windows is also redundant. This hostile attitude makes it very difficult to use Java on non-Solaris operating systems.

Whether this statement is true or not, Sun does not solve the Chinese problem of Java on Redhat, which brings great inconvenience to many Java programmers. Many people on Sun's website also asked this question, but few people provide better solutions, which is a pity.

Some time ago, when I used installanywhere to create an installer running on Redhat, the Chinese installation interface was always a block. I tried all the Java VMS on the installanywhere website one by one, but I still couldn't, I have read all the discussion groups on the installanywhere website, but I still cannot find a solution, which makes me doubt my IQ. Therefore, I made up my mind to check the Chinese version of Java on Redhat.

I first asked a chinese agent of installanywhere about this problem. He gave up his mind and said that installanywhere must support the creation of Chinese installers on Redhat. After many phone calls, I probably understood that sun does not want installanywhere to perform well on Redhat, so they cannot publish solutions on the website, we recommend Solaris. I said we couldn't afford Solaris, and there was no real progress.

I searched Google and Chinese Yahoo for several weeks without any results, but I had some materials. Later, I searched on the RedHat website and found some materials. Then I tried it several times and finally got it done.

Only the font. Properties of RedHat 6 is included in the standard JRE/JDK. I cannot use both RedHat 7.3 and RedHat 8.0. We need to create a font. properties. Zh. RedHat and put it in the JRE/lib directory of RedHat. Open/usr/lib/X11/fonts/TTF-ZH or font under/usr/share/fonts/zh_cn/TrueType. dir, copy one of the Chinese characters, such as-misc-ZYSong18030-medium-r-normal -- 0-0-0-0-c-0-iso10646-1, change to-misc-ZYSong18030-medium-r-normal -- *-% d-*-C-*-iso10646-1 according to the font rules of Java. properties. copy the content in ZH to font. properties. zh. in RedHat.

I chose the font-misc-ZYSong18030-medium-r-normal -- 0-0-0-0-c-0-iso10646-1 because it can be used on Redhat 7.3 and RedHat 8.0.

Because JRE/JDK cannot find the true type font of RedHat, add it at the end of the file font. properties. Zh. RedHat.

Appendedfontpath =/usr/lib/X11/fonts/TTF-ZH
Appendedfontpath =/usr/share/fonts/zh_cn/TrueType

Replace all the fonts with-misc-ZYSong18030-medium-r-normal -- *-% d-*-C-*-iso10646-1, And the replaced font. properties. Zh. RedHat is as follows:

# @ (#) Font. properties. Zh. RedHat. Linux 1.4 02/06/10
#
# Copyright 2002 Sun Microsystems, Inc. All rights reserved.
#

# Component font Mappings
#
Serif.0 =-misc-ZYSong18030-medium-r-normal -- *-% d-*-C-*-iso10646-1

Serif. italic.0 =-misc-ZYSong18030-medium-r-normal -- *-% d-*-C-*-iso10646-1

Serif. bold.0 =-misc-ZYSong18030-medium-r-normal -- *-% d-*-C-*-iso10646-1

Serif. bolditalic.0 =-misc-ZYSong18030-medium-r-normal -- *-% d-*-C-*-iso10646-1

Sansserif.0 =-misc-ZYSong18030-medium-r-normal -- *-% d-*-C-*-iso10646-1

Sansserif. italic.0 =-misc-ZYSong18030-medium-r-normal -- *-% d-*-C-*-iso10646-1

Sansserif. bold.0 =-misc-ZYSong18030-medium-r-normal -- *-% d-*-C-*-iso10646-1

Sansserif. bolditalic.0 =-misc-ZYSong18030-medium-r-normal -- *-% d-*-C-*-iso10646-1

Monospaced.0 =-misc-ZYSong18030-medium-r-normal -- *-% d-*-C-*-iso10646-1

Monospaced. italic.0 =-misc-ZYSong18030-medium-r-normal -- *-% d-*-C-*-iso10646-1

Monospaced. bold.0 =-misc-ZYSong18030-medium-r-normal -- *-% d-*-C-*-iso10646-1

Monospaced. bolditalic.0 =-misc-ZYSong18030-medium-r-normal -- *-% d-*-C-*-iso10646-1

Dialog.0 =-misc-ZYSong18030-medium-r-normal -- *-% d-*-C-*-iso10646-1

Dialog. italic.0 =-misc-ZYSong18030-medium-r-normal -- *-% d-*-C-*-iso10646-1

Dialog. bold.0 =-misc-ZYSong18030-medium-r-normal -- *-% d-*-C-*-iso10646-1

Dialog. bolditalic.0 =-misc-ZYSong18030-medium-r-normal -- *-% d-*-C-*-iso10646-1

Dialoginput.0 =-misc-ZYSong18030-medium-r-normal -- *-% d-*-C-*-iso10646-1

Dialoginput. italic.0 =-misc-ZYSong18030-medium-r-normal -- *-% d-*-C-*-iso10646-1

Dialoginput. bold.0 =-misc-ZYSong18030-medium-r-normal -- *-% d-*-C-*-iso10646-1

Dialoginput. bolditalic.0 =-misc-ZYSong18030-medium-r-normal -- *-% d-*-C-*-iso10646-1
# Missing glyph character
#
Default. Char = 274f

# Component font character encodings
#
Fontcharset. serif.0 = sun. Io. chartobyteiso8859_1
Fontcharset. serif.1 = sun. AWT. motif. chartobytex11gbk

Fontcharset. sansserif.0 = sun. Io. chartobyteiso8859_1
Fontcharset. sansserif.1 = sun. AWT. motif. chartobytex11gbk

Fontcharset. monospaced.0 = sun. Io. chartobyteiso8859_1
Fontcharset. monospaced.1 = sun. AWT. motif. chartobytex11gbk

Fontcharset. dialog.0 = sun. Io. chartobyteiso8859_1
Fontcharset. dialog.1 = sun. AWT. motif. chartobytex11gbk

Fontcharset. dialoginput.0 = sun. Io. chartobyteiso8859_1
Fontcharset. dialoginput.1 = sun. AWT. motif. chartobytex11gbk

# Exclusion ranges
#

# Xfontset Information
#
Fontset. serif. Plain = \
-Misc-ZYSong18030-medium-r-normal -- *-% d-*-C-*-iso10646-1

Fontset. serif. italic = \
-Misc-ZYSong18030-medium-r-normal -- *-% d-*-C-*-iso10646-1

Fontset. serif. Bold = \
-Misc-ZYSong18030-medium-r-normal -- *-% d-*-C-*-iso10646-1

Fontset. serif. bolditalic = \
-Misc-ZYSong18030-medium-r-normal -- *-% d-*-C-*-iso10646-1

Fontset. sansserif. Plain = \
-Misc-ZYSong18030-medium-r-normal -- *-% d-*-C-*-iso10646-1

Fontset. sansserif. italic = \
-Misc-ZYSong18030-medium-r-normal -- *-% d-*-C-*-iso10646-1

Fontset. sansserif. Bold = \
-Misc-ZYSong18030-medium-r-normal -- *-% d-*-C-*-iso10646-1

Fontset. sansserif. bolditalic = \
-Misc-ZYSong18030-medium-r-normal -- *-% d-*-C-*-iso10646-1

Fontset. monospaced. Plain = \
-Misc-ZYSong18030-medium-r-normal -- *-% d-*-C-*-iso10646-1

Fontset. monospaced. italic = \
-Misc-ZYSong18030-medium-r-normal -- *-% d-*-C-*-iso10646-1

Fontset. monospaced. Bold = \
-Misc-ZYSong18030-medium-r-normal -- *-% d-*-C-*-iso10646-1

Fontset. monospaced. bolditalic = \
-Misc-ZYSong18030-medium-r-normal -- *-% d-*-C-*-iso10646-1

Fontset. Dialog. italic = \
-Misc-ZYSong18030-medium-r-normal -- *-% d-*-C-*-iso10646-1

Fontset. Dialog. Bold = \
-Misc-ZYSong18030-medium-r-normal -- *-% d-*-C-*-iso10646-1

Fontset. Dialog. bolditalic = \
-Misc-ZYSong18030-medium-r-normal -- *-% d-*-C-*-iso10646-1

Fontset. Dialog. Plain = \
-Misc-ZYSong18030-medium-r-normal -- *-% d-*-C-*-iso10646-1

Fontset. dialoginput. italic = \
-Misc-ZYSong18030-medium-r-normal -- *-% d-*-C-*-iso10646-1

Fontset. dialoginput. Bold = \
-Misc-ZYSong18030-medium-r-normal -- *-% d-*-C-*-iso10646-1

Fontset. dialoginput. bolditalic = \
-Misc-ZYSong18030-medium-r-normal -- *-% d-*-C-*-iso10646-1

Fontset. dialoginput. Plain = \
-Misc-ZYSong18030-medium-r-normal -- *-% d-*-C-*-iso10646-1

# Fontset. Default = \
#-B & H-lucida-Medium-r-normal-sans-*-% d-*-p-*-iso10646-1 ,\
#-TLC-song-Medium-r-normal -- *-% d-*-C-*-gbk-0

Fontset. Default = \
-Misc-ZYSong18030-medium-r-normal -- *-% d-*-C-*-iso10646-1

Appendedfontpath =/usr/lib/X11/fonts/TTF-ZH
Appendedfontpath =/usr/share/fonts/zh_cn/TrueType

Use installanywhere to compile the installer and select "other Java platform" (other Java-enabled platforms option on the build page) to compile it into a Java setup. JAR file, write a batch processing/script file on Redhat, set classpath, including setup. jar, use Java install to start the installation program in the batch processing/script file.

This method is successfully tested under RedHat 7.3/8.0.

Create a font for the traditional Chinese in RedHat according to law. properties. in the zh_tw.redhat file, replace the font name with a traditional Chinese font name and add the appropriate appendedfontpath at the end of the file. Of course, do not forget to test it in RedHat 7.3 and 8.0.

Different Linux versions have different configuration methods. This is mainly because Linus Torvalds and other people who have voice components only focus on Linux kernel development. If they plan other aspects, the differences in Linux versions will not be as big as they are now. During the use of Java + LINUX, we deeply realized the pain points of "write once, debug everywhere.

Refer:
This is a solution officially provided by Sun,

Http://java.sun.com/j2se/1.5.0/docs/guide/intl/fontconfig.html

This also has reference value

Http://www.linuxsir.org/bbs/showthread.php? S = & threadid = 124319 & Highlight = Java

The program runs in Linux. All texts are displayed as "ports"

Http://book.77169.org/data/web5403/20050227/20050227__3670971.html

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.