posted 9 years ago
The getRealPath() method, while useful, isn't your optimal solution here.
What happens when your app is deployed in a jar file? What is the filepath to it then?
If you are trying to load an image from your bundle, then the ServletContext method getResourceAsStream is probably more appropriate;
It is very similar to getRealPath in invoking. The main difference being instead of telling you the path to the resource, it just gives it straight to you.