读书人

报路径错,该怎么解决

发布时间: 2012-03-18 13:55:39 作者: rapoo

报路径错
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
[解决办法]
写下绝对路径试试。
[解决办法]
很明,路不。

读书人网 >Java Web开发

热点推荐