users@glassfish.java.net

Re: Relative path on web applications?

From: <glassfish_at_javadesktop.org>
Date: Sun, 14 Sep 2008 18:42:50 PDT

If the file you're trying to open is bundled in your web app, and the code that needs to access the file is executed in a servlet or JSP, you could try starting with getServletContext().getRealPath("somefile"). That should point you in the right direction.

If your wsf file is packaged in a JAR that's in the runtime classpath, you could try someClass.getResourceAsStream("somefile"). This puts the job of finding the file on the ClassLoader.
[Message sent by forum member 'jpedwardsdotcom' (jpedwardsdotcom)]

http://forums.java.net/jive/thread.jspa?messageID=299275