Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » Tomcat Users »

Howto read files

dmu2201

2004-10-04


Hi ML....

I'm having a problem with tomcat because I would like to read a certain
XML file in a 'data' dir. The problem is that the relative path does not
work:
new File("data/questionnaires.xml/");
does not give the file since Tomcat is started from its bin dir and not
from my /webapps/PROJECT dir.

How do I, in a "nice" manner access that file with, hopefully, a
relative path. I need a relative path or some kind of 'property' that
enables me to access the file, independent of operating system.

I have tried to use a <Context path="/PROJECT" docBase="PROJECT" |
docBase="webapps/PROJECT" /> in a context.xml file in a META-INF dir,
but no luck :-(

My dir structure:
/webapps
--/PROJECT
--/data <---The dir I want to access
--/WEB-INF/
--/WEB-INF/src
--/WEB-INF/classes
--/displayQuestionnaires/
----/*.jsp

Hope someone can help...

Claus

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@(protected)
For additional commands, e-mail: tomcat-user-help@(protected)

©2008 junlu.com - Jax Systems, LLC, U.S.A.