java 读取配置文件

来源:互联网 发布:js设置p标签内容 编辑:程序博客网 时间:2024/06/09 17:51

java 读取配置文件

Properties pps;
Enumeration enum1;
try {     
//读取配置文件
pps=new Properties();   
pps.load(new FileInputStream("config.ini"));  
enum1 = pps.propertyNames();  

while (enum1.hasMoreElements()) {  

String strKey = (String) enum1.nextElement();  
String strValue = pps.getProperty(strKey);  
System.out.println(strKey + "=" + strValue);  

}  

} catch (Exception e) {  
e.printStackTrace();  

原创粉丝点击