URL url = ClassLoader.getSystemResource("config.properties");
File pFile = new File(url.getFile()); // properties文件放在e盘下(windows)
FileInputStream pInStream = null;
try {
pInStream = new FileInputStream(pFile);
} catch (FileNotFoundException e) {
e.printStackTrace(); // To change body of catch statement use
// File | Settings | File Templates.
}
p = new Properties();
try {
p.load(pInStream); // Properties 对象已生成,包括文件中的数据
} catch (IOException e) {
e.printStackTrace(); // To change body of catch statement use
// File | Settings | File Templates.
}