当前位置: 代码迷 >> Java Web开发 >> 报路径错,该怎么解决
  详细解决方案

报路径错,该怎么解决

热度:162   发布时间:2016-04-17 10:35:19.0
报路径错
public static void main(String args[]) {
String filePath = "/a.properties";
//writeProperties(filePath, "name", "wangmin");
System.out.println(ConfigInfo.readValue(filePath, "name1"));
}


报错:java.io.FileNotFoundException: \a.properties (系统找不到指定的文件。)
我的项目根目录下面有这个文件,这是怎么回事

------解决方案--------------------
String filePath = "/a.properties";
改成String filePath = "../a.properties";
试试。
要是确实还是找不到,你就把该文件的路径弄详细点啊, A/B/../a.properties
------解决方案--------------------
写下绝对路径试试。
------解决方案--------------------
很明顯,路徑不對。
  相关解决方案