There are a couple of methods on the ServletContext object that can help you load resources from your web application.
- getRealPath turns a web application relative location into a real directory location on the computer
- getResourceAsStream actually loads the file into a stream for you
getResourcesAsStream is slightly more reliable than the getRealPath method
getRealPath might return you a path that can't be used with the standard java.io.File class - e.g. if the servlet container hasn't expanded the war file, it might give you a path including a ! to indicate the file is compressed in an archive.