I want to read a file from a java web application. I don\'t want to give the absolute path of the file. I just want to put the file in some directory of my web application.<
there is another way, if you are using a container like Tomcat :
String textPath = "http://localhost:8080/NameOfWebapp/resources/images/file.txt";