17,377
社区成员
发帖
与我相关
我的任务
分享
在$JAVA_HOME/jre/lib/fonts/下建一个fallback目录,把你想在java中使用的字体复制到这个目录中即可,在oracle用户下:
$ mkdir $ORACLE_HOME/jdk/jre/lib/fonts/fallback
把windows下的字体文件simsun.ttc复制到$ORACLE_HOME/jdk/jre/lib/fonts/fallback目录下并改名simsun.ttf(注意ms的simsun字体是有版权的,所以商用换其他字体),相应的权限改为oracle用户可用.
之后需要清理一下Cache,重启EM即可:
$ rm $ORACLE_HOME/oc4j/j2ee/oc4j_applications/applications/em/em/cabo/images/cache/zhs/*.gif
原来是因为在安装oracle10时,JDK/JRE自动选择了字符集,而在$ORACLE_HOME/jdk/jre/lib和$ORACLE_HOME/jre/1.4.2/lib目录下,都有多种字体:
[oracle@linzhaorong lib]$ ll
-rwxr-xr-x 1 oracle oinstall 6966 11-18 22:00 font.properties
-rwxr-xr-x 1 oracle oinstall 5870 2005-04-20 font.properties_bak
-rwxr-xr-x 1 oracle oinstall 5681 2005-04-20 font.properties.Redhat6.1
-rwxr-xr-x 1 oracle oinstall 3828 2005-04-20 font.properties.Redhat8.0
-rwxr-xr-x 1 oracle oinstall 3752 2005-04-20 font.properties.SuSE8.0
-rwxr-xr-x 1 oracle oinstall 6854 2005-04-20 font.properties.zh_CN.Redhat
-rwxr-xr-x 1 oracle oinstall 7410 2005-04-20 font.properties.zh_CN.Redhat2.1
-rwxr-xr-x 1 oracle oinstall 6845 2005-04-20 font.properties.zh_CN.Sun
-rwxr-xr-x 1 oracle oinstall 7137 2005-04-20 font.properties.zh_CN_UTF8.Sun
-rwxr-xr-x 1 oracle oinstall 6922 2005-04-20 font.properties.zh_HK.Sun
-rwxr-xr-x 1 oracle oinstall 7132 2005-04-20 font.properties.zh_HK_UTF8.Sun
-rwxr-xr-x 1 oracle oinstall 5810 2005-04-20 font.properties.zh_HK_UTF8.Sun2003
-rwxr-xr-x 1 oracle oinstall 6521 2005-04-20 font.properties.zh.Turbo
-rwxr-xr-x 1 oracle oinstall 7236 2005-04-20 font.properties.zh_TW.Redhat
-rwxr-xr-x 1 oracle oinstall 7232 2005-04-20 font.properties.zh_TW.Redhat2.1
-rwxr-xr-x 1 oracle oinstall 6892 2005-04-20 font.properties.zh_TW.Sun
-rwxr-xr-x 1 oracle oinstall 7142 2005-04-20 font.properties.zh_TW_UTF8.Sun
-rwxr-xr-x 1 oracle oinstall 5810 2005-04-20 font.properties.zh_TW_UTF8.Sun2003
而每一个目录下都有一个缺省的字符集font.properties,我们只要用合适的中文字符集来替换缺省字符集即可,我选择的是font.properties.zh_CN.Redhat。
首先,我们应该先将em关闭:
emctl stop dbconsole
然后进行替换,注意,$ORACLE_HOME/jdk/jre/lib和$ORACLE_HOME/jre/1.4.2/lib目录下都要进行如下替换:
[oracle@redhat lib]$ cp font.properties.zh_CN.Redhat font.properties
替换之后,我们还要查一下,linux中有没有安装相应的中文字符集,怎么看?
[oracle@redhat lib]$ tail font.properties
fontset.dialoginput.plain=\
-b&h-luxi mono-medium-r-normal--*-%d-*-*-m-*-iso8859-1,\
-isas-song ti-medium-r-normal--*-%d-*-*-c-*-gb2312.1980-0
fontset.default=\
-b&h-luxi sans-medium-r-normal--*-%d-*-*-p-*-iso8859-1,\
-isas-song ti-medium-r-normal--*-%d-*-*-c-*-gb2312.1980-0
filename.-misc-zysong18030-medium-r-normal--*-%d-*-*-c-*-iso10646-1=/usr/share/fonts/zh_CN/TrueType/zysong.ttf -->查看字体文件是否存在,如果不存在,需要更改路径,或者安装相应字体文件。
根据最后一行的路径,我们去看看是否有该文件是否存在,如果没有,那说明没有安装相应的中文字符集,我们可以到linux的系统安装盘中去找到相应的rpm包,进行安装。
最后还要清理一下Cache,路径一般是
ORACLE_HOME/oc4j/j2ee/oc4j_applications/applications/em/em/cabo/images/cache/zhs
注意:只需要清理该路径下的gif文件即可:
rm *.gif
最后再将em开启,此时,我们发现,乱码不见了。
emctl start dbconsole