我当前的目录有一个名为“info”的文件。但是在使用新文件(“info”)时,我仍然会收到File not found错误;
我的cwd是:C:\ Users \ sit \ eclipse-workspace \ Assignment%03 \ bin \ info
String rootPath = Thread.currentThread().getContextClassLoader().getResource("").getPath();
String info_file = rootPath + "info";
// Read the properties into the internal structure
try {
identity.load(new FileInputStream(info_file));
} catch (Exception e) {
System.out.println(e.getMessage());
}
我得到的错误是:C:\ Users \ sit \ eclipse-workspace \ Assignment%03 \ bin \ info(系统找不到指定的路径)
但是我已经在指定的路径中找到了名为info的文件。不知道为什么没找到
我在Windows上使用Java 1.7,Eclipse平台
我将项目文件夹名称从Assignment 3更改为Assignment3,它解决了问题