Juha Laiho <> wrote in message news:<cmjbqi$2r2$-int>...
> (yair) said:
> >in a servlet running in tomcat, how can i get the full path of my web
> >application on the disk (something like "c:\progran
> >files\tomcat\webapps\myApp")?
> >i don't want to write it in the web.xml or to pass it as a system
> >property.
>
> Adding to the response by Will Hartung; for what would you need this;
> what would you do with the information? Once we know that, we may be
> able to propose alternative ways of solving the problem.
thanks for u're answer first.
i will have a folder named "tests" under webapps/myApp, and i want to
read the names of the files in this folder. i m going to show the user
a page with the names of those files and let him choose a file to run
(this ofcourse is a very simplified version of what i m trying to do).
this webapp will not be JAR-ed, so i dont have a problem with that.
it seems like:
javax.servlet.ServletContext.getRealPath("")
or
javax.servlet.ServletContext.getRealPath("/")
r working fine, i think i'll use this way.
thanks
yair