读类路径下配置文件

来源:互联网 发布:geckofx js调用c 函数 编辑:程序博客网 时间:2024/05/01 21:13
--1--------------------------------------
ResourceBundle resource = ResourceBundle.getBundle("net/rubyeye/test/config");
得到net/rubyeye/test/下面的config.properties
value=resource.getString("url") ;//得到配置文件的url属性
 
--2--------------------------------
private Properties props = new Properties();
InputStream infile = this.getClass().getResourceAsStream("/SystemConfig.properties");
      props.load(infile);
String url=props.getProperty("url");
String username=props.getProperty("username");
String username=props.getProperty("password");
 
==

http://blog.csdn.net/baobeiSimple/archive/2007/08/24/1757922.aspx