i tried it..but it still doesn't work.
it only works if i put it on the WEB-INF/classes directory.

what's the reason behind this?

also, if im going to read from a file using the File class in java, how
do i specify the correct path? do i have to place the file also on the
WEB-INF/classes directory?


Tharmarajah Sasi Dharma wrote:
did u try calling it with the direcotry structure
com.test.MyProperty.properties
r
sasi
-----Original Message-----
From: A mailing list for discussion about Sun Microsystem's Java Servlet API Technology. [mailto:[EMAIL PROTECTED]]On Behalf Of randie ursal
Sent: Tuesday, August 27, 2002 5:07 PM
To: [EMAIL PROTECTED]
Subject: Re: setting the classpath variable

why is it tomcat could not locate the property file if i place it on the
package directory structure of my servlets?...it is still on the WEB-INF/classes
directory isnt it? just need some more clarifications.

e.g  WEB-INF/classess/com/test/MyProperty.properties

thanks

Cédric Viaud wrote:
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

      
        

        

Reply via email to