• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to find a absolute path in a web application

 
Greenhorn
Posts: 28
Hibernate Eclipse IDE Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,
I have a web application running in tomcat. I have some configuration parameters which I need to use in my application in a xml file present in WEB-INF directory. All I need is to get the absolute path of the file so that I can read it. With servlet I can easily do it with init parameters in web.xml. But I can't use a servlet in my application. Can anyone suggest whether there's any way to do this from a normal java class.Thanks in advance

Regards,
vignesh
 
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Vignesh,
This is a web application, right? If so, you shouldn't use the absolute path of a resource. You can use getResourceAsStream from a regular Java class. Assuming the class was at some point called from a servlet, it is in the web container and your WEB-INF directory will be in the path.
reply
    Bookmark Topic Watch Topic
  • New Topic