Here is the structure of my project :
I need to read config.properties
inside MyClass.java
.
I tried to do so with a relative path as follows :
// Code called from MyClass.java
File f1 = new File("..\..\..\config.properties");
String path = f1.getPath();
prop.load(new FileInputStream(path));
This gives me the following error :
......config.properties (The system cannot find the file specified)
How can I define a relative path in Java? I'm using jdk 1.6 and working on windows.
Question&Answers:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…