新浪博客

获取项目根目录文件

2024-02-19 14:03阅读:
public static String getSfr() {
String filePath = System.getProperty('user.dir');
filePath += '\\WebContent\\fielList.text';
String sfr = null;
try {
BufferedReader reader = new BufferedReader(new FileReader(filePath));
try {
String temp;
while ((temp = reader.readLine()) != null) {
System.out.println(temp);
}
} catch (IOException e) {
e.printStackTrace();
}
} catch (FileNotFoundException e) {
e.printStackTrace();
}
return sfr;
}

我的更多文章

下载客户端阅读体验更佳

APP专享