Reprinted from the Yunnan Fox's personal homepage, the author expresses the high respect
JDK1.4:
Linux under the Java Swing default can not display Chinese characters, online this aspect of the introduction of a lot, but it seems not very detailed, so I think it is necessary to repeat these platitudes again.
First, switch to root using the SU command, and then switch to your JDK installation path using the CD command, for example, on my machine, the JDK is installed under/USR/JAVA/J2SDK1.4.2_01/.
Then, switch to the Jre/lib directory under the directory and back up the font.properties:
# cd/usr/java/j2sdk1.4.2_01/
# CD jre/lib/
# MV Font.properties Font.properties.bak
Next, Font.properties.zh_CN. Sun replicates as font.properties. If there's no Font.properties.zh_CN on your machine. Sun, there should be "Font.properties.zh_CN" or something. If not, you'd better reload a newer version of the JDK.
# CP Font.properties.zh_CN. Sun font.properties
Finally, edit the copied font.properties file, skip to the end of the file, find the "filename.xxx=" line, change the path to the path to the Simsun.ttf on your machine, and the Appendedfontpath line below. Accordingly, point the path to the folder where your Simsun.ttf resides.
=
=
JDK1.5 (This is not easy to find AH)
Linux under the Java Swing default can not display Chinese characters, the internet for JDK 1.4 Chinese configuration introduced a lot, Yunnan Fox's website also introduced this aspect content. In contrast, the relevant data on the Chinese configuration of JDK 1.5 is more difficult to find, Yunnan Fox spent a lot of time to configure the JDK 1.5 of the Chinese display, the configuration process is described in detail as follows:
First, switch to root using the SU command, and then switch to your JDK installation path using the CD command, for example, on my machine, the JDK is installed under/usr/java/jdk1.5.0_05/.
Then, switch to the Jre/lib directory under the directory, and you will see that there are many files in the directory that are shaped like fontconfig.*.properties.src. Select a properties that are closest to your system and copy it to fontconfig.properties. For example, my system is Fedora Core, so I use Fontconfig. Redhat.properties:
# CP Fontconfig. REDHAT.PROPERTIES.SRC fontconfig.properties
Edit the copied font.properties file and change the Chinese default font in the Component font mappings block at the beginning of the file to SimSun, as follows:
Next, add the SimSun path map to the Font File Names block, and change the following path to the path of the Simsun.ttf in your machine:
Finally, skip to the end of the file and point the AWT's font search path to the appropriate directory:
=
=
=