Hi gunjan
This was posted on the tomcat-user mailing list and i am just copying
and pasting the relevant portions..
***************
From: Amos Shapira <[EMAIL PROTECTED]>
Date: Mon, 21 Aug 2000 18:09:33 +0300
To: "'[EMAIL PROTECTED]'" <[EMAIL PROTECTED]>
Subject: RE: Help with properties file locations

Hi,

Use something like the following:

InputStream inputStream =
  MessageDb.class.getResourceAsStream("/MessageDb.properties");

  And put MessageDb.properties under classes, assuming that
  your class file is in com/mysite/support/MessageDb.class.

  The idea is that the resource file is looked up under the same
  CLASSPATH component under which your class file was found.

  The WEB-INF/classes directory is automatically added to the
  classpath for the "current" web application.

  Hope this helps,

  --Amos
*********************

Hope this helps
Anand Raman

On Thu, Aug 24, 2000 at 04:29:56PM -0400, Doshi, Gunjan wrote:
>Friends:
>I am using Tomcat.
>
>I put the properties file in web-inf/classes directory.
>I have my servlet in a package xxx.yyy.zzz.TestServlet.
>The package resides in web-inf/classes.
>
>I use the following way to access the code
>
>  String strFileName = "/Props.props";
> BufferedInputStream in =  new BufferedInputStream(new FileInputStream(
>strFileName));
>
>It gives me exception.
>
>Any help appreciated
>Gunjan
>
>===========================================================================
>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

--
Regards
Anand Raman
India Today Group Online

===========================================================================
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

Reply via email to