zjx2388 发表于 2013-2-3 13:24:55

java获取资源文件(**.properties)

import java.io.IOException;import java.util.Properties;public class PropertyMgr {static Properties props = new Properties();static {try {props.load(PropertyMgr.class.getClassLoader().getResourceAsStream("config/shopping.properties"));} catch (IOException e1) {e1.printStackTrace();}}private PropertyMgr() {};public static String getProperty(String key) {return props.getProperty(key);}} 
页: [1]
查看完整版本: java获取资源文件(**.properties)