更正已部署的war文件的文件路径以访问tomcat中的另一个文件

时间:2016-12-19 22:17:01

标签: java tomcat filepath

我通过复制到webapps文件夹手动部署.war文件:

C:\Program Files\Apache Software Foundation\Tomcat 8.5\webapps

在同一个webapps目录中,我添加了一个名为“properties.txt

的文件

我的.war文件访问“properties.txt”的正确文件路径是什么?

目前,我的代码是:

String path = "./properties.txt";
FileInputStream fis = new FileInputStream(path);
BufferedReader in = new BufferedReader(new InputStreamReader(fis));

但目前导致错误

  

java.io.FileNotFoundException:。\ properties.txt(系统不能   找到指定的文件)

非常感谢你的帮助!

0 个答案:

没有答案
相关问题