我需要读config.properties
里面MyClass.java
。我尝试通过如下相对路径进行操作:
// Code called from MyClass.javaFile f1 = new File("..\\..\\..\\config.properties"); String path = f1.getPath(); prop.load(new FileInputStream(path));
这给了我以下错误:
..\..\..\config.properties (The system cannot find the file specified)
如何在Java中定义相对路径?我正在使用jdk 1.6并在Windows上工作。
相关分类