Hi, you can also do something like this :
Properties prop = new Properties(); prop.load(this.getClass().getResourceAsStream("/MyProperties.properties")); With this syntax you just put the file in the WEB_INF/classes directory and the ClassLoader found it there. Regards, Cédric NB : this exemple comes from another mailing list "Tomcat-users" ----- Original Message ----- From: "Nic Ferrier" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, August 27, 2002 10:32 AM Subject: Re: setting the classpath variable > randie ursal <[EMAIL PROTECTED]> writes: > > > hi, > > > > i have this newbie question. > > > > here is the scenario, i have a servlet that will read a ".properties" > > file and i make use of the PropertyResourceBundle class to read the > > value from the property file. > > > > the problem is that the PropertyResourceBundle doesn't find the > > properties file. > > > > the API for ResourceBundle said that my properties file must be set on > > the classpath. > > > > so, how do i set this file so that it will be located by my servlet? > > > > i tried placing my properties file on the /lib directory of my web > > application but it doesn't work...or do i have to explicitly include > > it on my classpath environment variable? > > Servlet containers provide protected class paths. You could put your > property file in the "WEB-INF/classes" directory of your war file (or > directory structure). > > > Nic > > ___________________________________________________________________________ > To unsubscribe, send email to [EMAIL PROTECTED] and include in the body > of the message "signoff SERVLET-INTEREST". > > Archives: http://archives.java.sun.com/archives/servlet-interest.html > Resources: http://java.sun.com/products/servlet/external-resources.html > LISTSERV Help: http://www.lsoft.com/manuals/user/user.html > ___________________________________________________________________________ To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff SERVLET-INTEREST". Archives: http://archives.java.sun.com/archives/servlet-interest.html Resources: http://java.sun.com/products/servlet/external-resources.html LISTSERV Help: http://www.lsoft.com/manuals/user/user.html