java读取配置Properties文件
config.properties:
import java.io.FileInputStream;import java.util.Enumeration;import java.util.Properties; class PropTest { public static void main(String[] args) {Properties pps=new Properties(); try { pps.load(new FileInputStream("config.properties")); Enumeration enum = pps.propertyNames(); while (enum.hasMoreElements()) { String strKey = (String) enum1.nextElement(); String strValue = pps.getProperty(strKey); System.out.println(strKey + "=" + strValue); } } catch (Exception e) { e.printStackTrace(); } }}