I have a project named SampleProj in eclipse.
The project structure is mentioned as below :
SampleProj
|
-- META-INF
|
-- dbdetails.properties
Currently,I'm reading the file like this :
FileReader reader = new FileReader("C://Workspace//SampleProj/META-INF//dbdetails.properties");
But this path is local to my system rit. So, I want to make this path generic.
So, I'm trying to keep the path like this :
FileReader reader = new FileReader("SampleProj/META-INF//dbdetails.properties");
But,I'm getting file not found exception.
How can I read this file from Project. Can anyone please help me out regarding this ...
You can retrieve using :
String workingDir = System.getProperty("user.dir");
Then you can do it like this :
FileReader reader = new FileReader(workingDir +"//SampleProj//META-INF//dbdetails.properties");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With