FileInputStream in = null;
Properties properties = new Properties();
String classpath = null;
try{
classpath = Thread.currentThread().getContextClassLoader().getResource("/").toString();
classpath = classpath.substring(5);
in = new FileInputStream(classpath+"filename");
properties.load(in);
}catch (Exception e) {
System.err.println(classpath+"filename not found");
return false;
}
读取web工程根目录下的文件
最新推荐文章于 2021-08-11 13:35:04 发布