Sorry to tell you that it does work.
I've tried used this on various platforms with various software deployed on
various platforms, like Jserv, Tomcat, WebLogic, Jrun on Win2000, Linux,
Solaris, HP-UX.
So it's fair to say that this contruct does work ;)
Wouter
-----Original Message-----
From: Mark [mailto:[EMAIL PROTECTED]]
Sent: 18 April 2001 16:08
To: [EMAIL PROTECTED]
Subject: Re: How to read property files?
>
> InputStream is =
this.getClass().getResourceAsStream("myapp.properties");
> Properties p = new Properties();
> try {
> p.load(is);
> } catch ( java.io.IOException e ) {
> // Can't load props file
> }
>
> That way the properties file can be anywhere in the classpath.
>
>
Have you tried doing this from a class inside a .jar file? I have
and it didn't work.
> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, April 17, 2001 9:27 PM
> To: [EMAIL PROTECTED]
> Subject: How to read property files?
>
>
> I would like to put a myapp.properties file in the top level directory
> of my webapp. But I can't figure out what filepath to give the
> Properties.load() method in order to load my servlet property object.
> Can someone help me?
>
> Thanks
>
> =eas=
>