标签:
package main; import java.io.FileInputStream; import java.io.IOException; import java.util.Properties; public class WrieadMain{ public static void main(String[] args) { Properties prop = new Properties(); String path = Thread.currentThread().getContextClassLoader().getResource("init.properties").getPath(); try { FileInputStream fis = new FileInputStream(path); prop.load(fis); } catch (IOException e) { e.printStackTrace(); System.out.println("初始化失败,配置文件错误!"); } prop.list(System.out); System.out.println("\nThe foo property: " +prop.getProperty("foo")); } }
标签:
原文地址:http://www.cnblogs.com/bilking/p/5095824.html