Here is the structure of my project :
I need to read
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.