Stefan, There isn't, in fact, any guaranteed way to obtain the real path to a resource on your system. ServletContext.getRealPath() will work if you are using a filesystem, rather than a war etc. However, if your goal is simply to access a file in some directory associated with your web application, you can use the ServletContext.getResource() or ServletContext.getResourceAsStream() methods. These methods are meant specifically for accessing resources associated/distributed with your web application. -AMT > -----Original Message----- > From: Stefan Freyr Stefansson [mailto:[EMAIL PROTECTED]] > Sent: Monday, October 09, 2000 6:56 AM > To: [EMAIL PROTECTED] > Subject: how to get the absolute path to a webapp > > > Hello. > > I'm working with Tomcat 3.2 and I would like to know how to > get the absolute > path to the root of the webapp I'm in... > > Like if I wanted to keep a file in a 'conf' directory or even > 'WEB-INF' > directory of the web app... how could I access that through a > JSP? Is there > any method to call to get the absolute path of the web-app so > I could say > for example: > accessFile(something.getAbsolutePath() + "\WEB-INF\file.dem"); > > Any help would be greatly appreciated. > > Kind regards, > Stefan > > ============================================================== > ============= > To unsubscribe: mailto [EMAIL PROTECTED] with body: > "signoff JSP-INTEREST". > Some relevant FAQs on JSP/Servlets can be found at: > > http://java.sun.com/products/jsp/faq.html > http://www.esperanto.org.nz/jsp/jspfaq.html > http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP > http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets > =========================================================================== To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST". Some relevant FAQs on JSP/Servlets can be found at: http://java.sun.com/products/jsp/faq.html http://www.esperanto.org.nz/jsp/jspfaq.html http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
