Hi all,
I want to read a properties file from the same directory as my program, e.g. my program is in C:\WorkSpage\Myprogram.java and I have a properties file called index.properties how can I read the file, without specifying a path?
I have tried the following but it doesn't read the file:
private static final String FILE_NAME = "objectid.properties";
File f = new File(FILEP_NAME);
if(f.exists()){
Properties pro = new Properties();
FileInputStream in = new FileInputStream(f);
pro.load(in);
// rest of code that handle the values from file....
}
But if I specify my FILE_NAME value as "C:\WorkSpage\index.properties" and give it an absolut path, then it works.
Can someone please advise...
Thanks.