Java Servlet - Configuration files for utility classes for Tomcat web application

I need to read a configuration file in my web application. Below is how i set up my app

src/conf/sample.properites

src/com/xyz/MyClass.java

WebContent/index.html

I get java.io.FileNotFoundException when i read the configuration file using this code below.

props.load(new FileInputStream("./conf/sample.properties"));

Can any one point me what I am doing wrong.I could able to see the properties after deploying in the folder app/WEB-INF/classes/conf folder.

[503 byte] By [skuncha5263a] at [2007-11-26 23:15:08]
# 1

What you are doing wrong is assuming you know what the current working directory is, and using a relative path based on your incorrect assumption. You want something like this:

props.load(

getServletConfig().getServletContext().getResourceAsStream("/conf/sample.properties"));

DrClapa at 2007-7-10 14:14:40 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...