LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 2655|回复: 10

看了精华贴,还是不会,FC8下JAVA的中文环境怎么设置,非常感谢

[复制链接]
发表于 2008-5-21 00:31:30 | 显示全部楼层 |阅读模式
我按照这个方法

Linux下java的Swing/AWT程序乱码解决

cd <JAVA_HOME>/lib/fonts或者cd <JAVA_HOME>/jre/lib/fonts
mkdir fallback

其中<JAVA_HOME>是你安装jdk/jre的路径,我的是/usr/lib/jdk1.5。复制或者链接一个中文字体至其下:

ln -s /usr/share/fonts/truetype/simsun.ttf /usr/lib/jdk1.5/jre/lib/fonts/fallback/simsun.ttf



进入到jvm时

[root@localhost jvm]# ls
java                    java-1.7.0                  java-icedtea   jre-1.7.0
java-1.5.0              java-1.7.0-icedtea          jre            jre-1.7.0-icedtea
java-1.5.0-gcj          java-1.7.0-icedtea-1.7.0.0  jre-1.5.0      jre-gcj
java-1.5.0-gcj-1.5.0.0  java-gcj                    jre-1.5.0-gcj  jre-icedtea


接着
[root@localhost jvm]# cd jre
[root@localhost jre]# ls
bin  lib
[root@localhost jre]# cd lib
[root@localhost lib]# ls
accessibility.properties  fontconfig.Fedora.properties.src  logging.properties
applet                    fontconfig.properties.src         management
audio                     fontconfig.SuSE.bfc               management-agent.jar
calendars.properties      fontconfig.SuSE.properties.src    meta-index
charsets.jar              fontconfig.Ubuntu.bfc             net.properties
classlist                 fontconfig.Ubuntu.properties.src  psfontj2d.properties
cmm                       i386                              psfont.properties.ja
content-types.properties  im                                resources.jar
currency.data             images                            rt.jar
ext                       jce.jar                           security
flavormap.properties      jexec                             sound.properties
fontconfig.bfc            jsse.jar                          zi
fontconfig.Fedora.bfc     jvm.hprof.txt
[root@localhost lib]# cd zi
[root@localhost zi]# cd fallback/
[root@localhost fallback]# ln -s /usr/share/fonts/zh_CN/TrueType/zysong.ttf zysong.ttf


可是设置后JAVA程序还是有中文乱码,请问可以怎么解决,谢谢!
发表于 2008-5-22 09:11:10 | 显示全部楼层
我没有使用链接,直接把字体复制进去就可以了.不知道你那边的情况.我是Slackware,JDK1.5.
回复 支持 反对

使用道具 举报

 楼主| 发表于 2008-5-22 21:19:15 | 显示全部楼层
谢谢,我用的是FC8,java -version 的结果为 1.7.0 ,我的电脑上有java 1.5.0和1.7.0两个版本
后来我又搜了很多贴子(如http://doc.linuxpk.com/1462.html),发现1.7.0版本里面的fontconfig.****.
properties文件的内容和网上大家说的内容不同,所以不知道怎么改

我的 fontconfig.properties的内容为
# @(#)linux.fontconfig.Fedora.properties        1.4 07/05/05
#
#
# Copyright 2007 Sun Microsystems, Inc.  All Rights Reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation.  Sun designates this
# particular file as subject to the "Classpath" exception as provided
# by Sun in the LICENSE file that accompanied this code.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
# CA 95054 USA or visit www.sun.com if you need additional information or
# have any questions.
#

# Version

# Uses Fedora Core 6 fonts and file paths.
version=1

# Component Font Mappings

Mappingsallfonts.chinese-cn-iso10646=-misc-simsun-medium-r-normal--*-%d-*-*-c-*-iso10646-1
dialog.plain.latin-1=DejaVu LGC Sans
dialog.plain.japanese-x0208=Sazanami Gothic
dialog.plain.korean=Baekmuk Gulim
dialog.plain.chinese-big5=AR PL ShanHeiSun Uni
dialog.plain.chinese-gb18030=AR PL ShanHeiSun Uni

dialog.bold.latin-1=DejaVu LGC Sans Bold
dialog.bold.japanese-x0208=Sazanami Gothic
dialog.bold.korean=Baekmuk Gulim
dialog.bold.chinese-big5=AR PL ShanHeiSun Uni
dialog.bold.chinese-gb18030=AR PL ShanHeiSun Uni

dialog.italic.latin-1=DejaVu LGC Sans Oblique
dialog.italic.japanese-x0208=Sazanami Gothic
dialog.italic.korean=Baekmuk Gulim
dialog.italic.chinese-big5=AR PL ShanHeiSun Uni
dialog.italic.chinese-gb18030=AR PL ShanHeiSun Uni

dialog.bolditalic.latin-1=DejaVu LGC Sans Bold Oblique
dialog.bolditalic.japanese-x0208=Sazanami Gothic
dialog.bolditalic.korean=Baekmuk Gulim
dialog.bolditalic.chinese-big5=AR PL ShanHeiSun Uni
dialog.bolditalic.chinese-gb18030=AR PL ShanHeiSun Uni


sansserif.plain.latin-1=DejaVu LGC Sans
sansserif.plain.japanese-x0208=Sazanami Gothic
sansserif.plain.korean=Baekmuk Gulim
sansserif.plain.chinese-big5=AR PL ShanHeiSun Uni
sansserif.plain.chinese-gb18030=AR PL ShanHeiSun Uni

sansserif.bold.latin-1=DejaVu LGC Sans Bold
sansserif.bold.japanese-x0208=Sazanami Gothic
sansserif.bold.korean=Baekmuk Gulim
sansserif.bold.chinese-big5=AR PL ShanHeiSun Uni
sansserif.bold.chinese-gb18030=AR PL ShanHeiSun Uni

sansserif.italic.latin-1=DejaVu LGC Sans Oblique
sansserif.italic.japanese-x0208=Sazanami Gothic
sansserif.italic.korean=Baekmuk Gulim
sansserif.italic.chinese-big5=AR PL ShanHeiSun Uni
sansserif.italic.chinese-gb18030=AR PL ShanHeiSun Uni

sansserif.bolditalic.latin-1=DejaVu LGC Sans Bold Oblique
sansserif.bolditalic.japanese-x0208=Sazanami Gothic
sansserif.bolditalic.korean=Baekmuk Gulim
sansserif.bolditalic.chinese-big5=AR PL ShanHeiSun Uni
sansserif.bolditalic.chinese-gb18030=AR PL ShanHeiSun Uni


serif.plain.latin-1=DejaVu LGC Serif
serif.plain.japanese-x0208=Sazanami Mincho
serif.plain.korean=Baekmuk Batang
serif.plain.chinese-big5=AR PL ZenKai Uni
serif.plain.chinese-gb18030=AR PL ZenKai Uni

serif.bold.latin-1=DejaVu LGC Serif Bold
serif.bold.japanese-x0208=Sazanami Mincho
serif.bold.korean=Baekmuk Batang
serif.bold.chinese-big5=AR PL ZenKai Uni
serif.bold.chinese-gb18030=AR PL ZenKai Uni

serif.italic.latin-1=DejaVu LGC Serif Oblique
serif.italic.japanese-x0208=Sazanami Mincho
serif.italic.korean=Baekmuk Batang
serif.italic.chinese-big5=AR PL ZenKai Uni
serif.italic.chinese-gb18030=AR PL ZenKai Uni

serif.bolditalic.latin-1=DejaVu LGC Serif Bold Oblique
serif.bolditalic.japanese-x0208=Sazanami Mincho
serif.bolditalic.korean=Baekmuk Batang
serif.bolditalic.chinese-big5=AR PL ZenKai Uni
serif.bolditalic.chinese-gb18030=AR PL ZenKai Uni


monospaced.plain.latin-1=DejaVu LGC Sans Mono
monospaced.plain.japanese-x0208=Sazanami Gothic
monospaced.plain.korean=Baekmuk Gulim
monospaced.plain.chinese-big5=AR PL ShanHeiSun Uni
monospaced.plain.chinese-gb18030=AR PL ShanHeiSun Uni

monospaced.bold.latin-1=DejaVu LGC Sans Mono Bold
monospaced.bold.japanese-x0208=Sazanami Gothic
monospaced.bold.korean=Baekmuk Gulim
monospaced.bold.chinese-big5=AR PL ShanHeiSun Uni
monospaced.bold.chinese-gb18030=AR PL ShanHeiSun Uni

monospaced.italic.latin-1=DejaVu LGC Sans Mono Oblique
monospaced.italic.japanese-x0208=Sazanami Gothic
monospaced.italic.korean=Baekmuk Gulim
monospaced.italic.chinese-big5=AR PL ShanHeiSun Uni
monospaced.italic.chinese-gb18030=AR PL ShanHeiSun Uni

monospaced.bolditalic.latin-1=DejaVu LGC Sans Mono Bold Oblique
monospaced.bolditalic.japanese-x0208=Sazanami Gothic
monospaced.bolditalic.korean=Baekmuk Gulim
monospaced.bolditalic.chinese-big5=AR PL ShanHeiSun Uni
monospaced.bolditalic.chinese-gb18030=AR PL ShanHeiSun Uni


dialoginput.plain.latin-1=DejaVu LGC Sans Mono
dialoginput.plain.japanese-x0208=Sazanami Gothic
dialoginput.plain.korean=Baekmuk Gulim
dialoginput.plain.chinese-big5=AR PL ShanHeiSun Uni
dialoginput.plain.chinese-gb18030=AR PL ShanHeiSun Uni

dialoginput.bold.latin-1=DejaVu LGC Sans Mono Bold
dialoginput.bold.japanese-x0208=Sazanami Gothic
dialoginput.bold.korean=Baekmuk Gulim
dialoginput.bold.chinese-big5=AR PL ShanHeiSun Uni
dialoginput.bold.chinese-gb18030=AR PL ShanHeiSun Uni

dialoginput.italic.latin-1=DejaVu LGC Sans Mono Oblique
dialoginput.italic.japanese-x0208=Sazanami Gothic
dialoginput.italic.korean=Baekmuk Gulim
dialoginput.italic.chinese-big5=AR PL ShanHeiSun Uni
dialoginput.italic.chinese-gb18030=AR PL ShanHeiSun Uni

dialoginput.bolditalic.latin-1=DejaVu LGC Sans Mono Bold Oblique
dialoginput.bolditalic.japanese-x0208=Sazanami Gothic
dialoginput.bolditalic.korean=Baekmuk Gulim
dialoginput.bolditalic.chinese-big5=AR PL ShanHeiSun Uni
dialoginput.bolditalic.chinese-gb18030=AR PL ShanHeiSun Uni

# Search Sequences

sequence.allfonts=latin-1
sequence.allfonts.Big5=chinese-big5,latin-1
sequence.allfonts.x-euc-jp-linux=japanese-x0208,latin-1
sequence.allfonts.EUC-KR=korean,latin-1
sequence.allfonts.GB18030=chinese-gb18030,latin-1
sequence.fallback=chinese-big5,chinese-gb18030,japanese-x0208,korean

# Font File Names
filename.-misc-simsun-medium-r-normal--*-%d-*-*-c-*-iso10646-1=/usr/share/fonts/local/simsun.ttc
filename.DejaVu_LGC_Sans=/usr/share/fonts/dejavu-lgc/DejaVuLGCSans.ttf
filename.DejaVu_LGC_Sans_Bold=/usr/share/fonts/dejavu-lgc/DejaVuLGCSans-Bold.ttf
filename.DejaVu_LGC_Sans_Oblique=/usr/share/fonts/dejavu-lgc/DejaVuLGCSans-Oblique.ttf
filename.DejaVu_LGC_Sans_Bold_Oblique=/usr/share/fonts/dejavu-lgc/DejaVuLGCSans-BoldOblique.ttf

filename.DejaVu_LGC_Sans_Mono=/usr/share/fonts/dejavu-lgc/DejaVuLGCSansMono.ttf
filename.DejaVu_LGC_Sans_Mono_Bold=/usr/share/fonts/dejavu-lgc/DejaVuLGCSansMono-Bold.ttf
filename.DejaVu_LGC_Sans_Mono_Oblique=/usr/share/fonts/dejavu-lgc/DejaVuLGCSansMono-Oblique.ttf
filename.DejaVu_LGC_Sans_Mono_Bold_Oblique=/usr/share/fonts/dejavu-lgc/DejaVuLGCSansMono-BoldOblique.ttf

filename.DejaVu_LGC_Serif=/usr/share/fonts/dejavu-lgc/DejaVuLGCSerif.ttf
filename.DejaVu_LGC_Serif_Bold=/usr/share/fonts/dejavu-lgc/DejaVuLGCSerif-Bold.ttf
filename.DejaVu_LGC_Serif_Oblique=/usr/share/fonts/dejavu-lgc/DejaVuLGCSerif-Oblique.ttf
filename.DejaVu_LGC_Serif_Bold_Oblique=/usr/share/fonts/dejavu-lgc/DejaVuLGCSerif-BoldOblique.ttf

filename.Sazanami_Gothic=/usr/share/fonts/japanese/TrueType/sazanami-gothic.ttf
filename.Sazanami_Mincho=/usr/share/fonts/japanese/TrueType/sazanami-mincho.ttf
filename.AR_PL_ShanHeiSun_Uni=/usr/share/fonts/chinese/TrueType/uming.ttf
filename.AR_PL_ZenKai_Uni=/usr/share/fonts/chinese/TrueType/ukai.ttf
filename.Baekmuk_Gulim=/usr/share/fonts/korean/TrueType/gulim.ttf
filename.Baekmuk_Batang=/usr/share/fonts/korean/TrueType/batang.ttf

# awt x11 font pathsawtfontpath.chinese-tw-
iso10646=/usr/local/share/fontsawtfontpath.chinese-cn-
iso10646=/usr/local/share/fontsawtfontpath.japanese-
iso10646=/usr/local/share/fontsawtfontpath.korean-
iso10646=/usr/local/share/fonts

我加了Mappingsallfonts.chinese-cn-iso10646=-misc-simsun-medium-r-normal--*-%d-*-*-c-*-iso10646-1
等内容还是不行,不知道什么原因
回复 支持 反对

使用道具 举报

发表于 2008-5-22 22:03:41 | 显示全部楼层
I am not sure what's wrong, it works in my fc9 and slackware, both jdk1.5 and 1.6.
回复 支持 反对

使用道具 举报

 楼主| 发表于 2008-5-23 12:20:29 | 显示全部楼层
不知道什么原因,贴子在自动识别url时把后面的内容屏蔽了,不知道现在看清楚没

ls,你是怎么改的呢(,直接把字体复制进去就可以了?)

谢谢
回复 支持 反对

使用道具 举报

 楼主| 发表于 2008-5-23 12:25:06 | 显示全部楼层
我又看了一下上面的fontconfig.properties
发现 # Version

# Uses Fedora Core 6 fonts and file paths.
version=1

用的是Fedora Core 6,是这个原因?
回复 支持 反对

使用道具 举报

发表于 2008-5-24 10:24:01 | 显示全部楼层
我啥也没改,只是把字体放进去了.
回复 支持 反对

使用道具 举报

 楼主| 发表于 2008-5-26 21:41:22 | 显示全部楼层
谢谢了,前几天不能上网所以没回贴,不好意思
回复 支持 反对

使用道具 举报

发表于 2008-5-27 13:34:16 | 显示全部楼层
问题解决了没?
回复 支持 反对

使用道具 举报

 楼主| 发表于 2008-5-28 23:23:15 | 显示全部楼层
谢谢

已经解决了
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表