You'll want to use getResource when your in a jar file. I've found the
safest way is just to know where the property file will be in relation to
the class loading it, and get the URL resource for the class itself. This
URL will differ for a class in a jar, but its still doable.

sam
----- Original Message -----
From: "Mark" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, April 18, 2001 3:08 PM
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.
>
>


Reply via email to