首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > Eclipse开发 >

Myeclipse 读取汉语路径的配置文件

2012-12-24 
Myeclipse 读取中文路径的配置文件public String getValue(String key) throws Exception{ Properties pro

Myeclipse 读取中文路径的配置文件

public String getValue(String key) throws Exception{ Properties properties = new Properties(); //文件被放在classes的根路径下,如果不在自己改 InputStream in =PropertyUtil.class.getClassLoader ().getResourceAsStream("demo.properties"); properties.load(in); String value =new String (properties.getProperty(key).getBytes("ISO-8859-1"),"GBK");return value; }

?

重要的就是这一句,进行一下编码方式的转换,即可。

热点排行