Hi
I think u can try getContextPath() which will give u the root of ur web application 
.To get access to resources inside WAR or other archive files u can use the method 
getResource(String URIPath);
 If the context is in a different m/c u can use getContext() to get the context first 
and then use either getResource() or getResourceAsStream() methods

*********** REPLY SEPARATOR  ***********

On 4/19/02 at 3:22 PM Eichfelder, Frank wrote:

Hi,

how can I get the location from the webapps-directory on my filesystem?

It's easy, if I use

String path = getServletContext().getRealPath("/");

and then cut off the last part:

int index = path.lastIndexOf(System.getProperty("file.separator"),
path.length()-2 );

path = path.substring(0, index);

But this works only, if you have your webapplication unpacked in the
file-system or if you have set unpackWars=true.

Now, I have set unpackWars=false, and now I get null for
getServletContext().getRealPath("/").

Is there any possibility to get the name of the war-File an application is
stored in or the name of the directory the war-file is stored in?

Thanks,

Frank

--
To unsubscribe:   <mailto:[EMAIL PROTECTED]>
For additional commands: <mailto:[EMAIL PROTECTED]>
Troubles with the list: <mailto:[EMAIL PROTECTED]>




--
To unsubscribe:   <mailto:[EMAIL PROTECTED]>
For additional commands: <mailto:[EMAIL PROTECTED]>
Troubles with the list: <mailto:[EMAIL PROTECTED]>

Reply via email to