Instead of getResourceAsStream you can use getResource, which
returns a URL. You can then break down the URL to determine where it found
the resource (and what protocol it used, i.e. file, jar, http, etc).
Randy
> -----Original Message-----
> From: Jim Willeke [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, April 18, 2001 9:25 AM
> To: [EMAIL PROTECTED]
> Subject: Re: How to read property files?
>
>
> Thanks, this helps me.
> I was wondering though, can you determine where it found the
> properties
> file at?
> Thanks.
> -jim
>
> Samson, Lyndon [IT] wrote:
>
> > This works a treat for me
> >
> > 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.
> >
> >
> > -----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=
> >
> >
> >
>