读书人

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

发布时间: 2012-12-24 10:43:13 作者: rapoo

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; }

?

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

读书人网 >Eclipse开发

热点推荐