现在的位置: 首页 > 综合 > 正文

java4: 读取配置文件

2012年12月06日 ⁄ 综合 ⁄ 共 356字 ⁄ 字号 评论关闭

目前之实现了一个简单的

获取xx.properties的配置值的

	public static String getConfigValue(String configKey) throws IOException {
		FileInputStream reader = new FileInputStream("config.properties");

		Properties p = new Properties();
		try {
			p.load(reader);
		} catch (IOException ex) {
			ex.printStackTrace();
		}

		return p.getProperty(configKey);
	}

 

 

其他参考文档

http://www.cnblogs.com/shang20017/archive/2009/04/16/1437271.html

抱歉!评论已关闭.