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.<
The alternative would be to use ServletContext.getResource() which returns a URI. This URI may be a 'file:' URL, but there's no guarantee for that.
You don't need it to be a file:... URL. You just need it to be a URL that your JVM can read--and it will be.