Ubuntu - JVM环境下中文不显示. 解决


       最近在Ubuntu下用运行astah(一个依赖jvm的uml图形化工具)时, 无法显示中文.  所有的中文都以方框来显示. 

在网上找相关的问题都说是缺失中文字体. 并将win的simsun.ttc拷贝到 jre/lib/fonts/fallback/下, 但试过后不管用. 

所以考虑是否是jvm字体配置问题. 

在本机/usr/lib/jvm/如下:


找到关于font相关的配置文件 /usr/lib/jvm/java-6-openjdk-amd64/jre/lib/fontconfig.properties

其实是link到了/etc/java-6-openjdk/fontconfig.properties 

并在其中找到关于JVM中文支持的相关项.

# Version

# Uses Ubuntu 8.04 (hardy), Debian 6.0 (Squeeze) (and more recent releases) fonts and file paths.
version=1

# Component Font Mappings

# Chinese fonts
allfonts.umingcn=AR PL UMing CN
#allfonts.umingcn.motif=AR PL UMing CN
allfonts.uminghk=AR PL UMing HK
#allfonts.uminghk.motif=AR PL UMing HK
allfonts.umingtw=AR PL UMing TW
#allfonts.umingtw.motif=AR PL UMing TW
allfonts.wqy-microhei=WenQuanYi Micro Hei
allfonts.wqy-zenhei=WenQuanYi Zen Hei
#allfonts.wqy-zenhei.motif=WenQuanYi Zen Hei
allfonts.shanheisun=AR PL ShanHeiSun Uni
#allfonts.shanheisun.motif=AR PL ShanHeiSun Uni

................
................
................

# AWT X11 font paths
awtfontpath.latin-1=/usr/share/fonts/X11/Type1
awtfontpath.umingcn=/usr/share/fonts/truetype/arphic
awtfontpath.uminghk=/usr/share/fonts/truetype/arphic
awtfontpath.umingtw=/usr/share/fonts/truetype/arphic
awtfontpath.shanheisun=/usr/share/fonts/truetype/arphic

从中可以看到AWT使用的中文字体存在于/usr/share/fonts/truetype/arphic下

但是查看并不存在arphic目录. 

所以可以肯定是少了字体umingXX, 所以google搜索相关的字体安装即可.

下载地址

https://packages.debian.org/wheezy/all/fonts-arphic-uming/download

ftp.cn.debian.org/debian

在命令行安装执行安装.

sudo dpkg -i fonts-arphic-uming_0.2.20080216.2-4_all.deb

安装成功后会在arphic目录下找到uming.ttc  如下,  此时JVM环境下的AWT就可以使用中文了.



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值