java 代码如下:
String filePath = this.getClass().getClassLoader().getResource(
"config.props").getPath();
InputStream in = null;
try {
in = new BufferedInputStream(new FileInputStream(filePath));
// new BufferedInputStream(new FileInputStream(filePath));
pro.load(in);
in.close();
System.out.println("配置文件里的属性:"
+ String.valueOf(pro.getProperty("call")));
} catch (IOException ioe) {
ioe.printStackTrace();
}
注意:配置文件里的属性是以 key/value 的形式存在的,要把config.props放到WEB-INF\classes下