Hi all,

I have a folder structure like this.

dir1 ---> conf ---> a.txt
dir1 ----> dir2 ---> dir3 ---> Test.java

How can I read a.txt file from my Test class ? How can I use relative path there?

File newFile = new File ( "<how to specify the path>" );

Thanks

Darshana

Depends on what is your current working directory i.e. the directory from which you are running your Java program.
For example if your current working directory is dir1 , then your relative path would be conf/a.txt Else if it is dir2 , it would change to ../conf/a.txt But if it is dir3 , then I think you will need to use the absolute path !!!