Hi all,
    I have difficulties with properties files but somewhat different. May be
someone knows how to deal with them.

1)  Why the following code :
    String resName = "/ru/cboss/www/i18n/Messages.properties";
        InputStream is1 = this.getClass().getResourceAsStream(resName);
        InputStream is2 =
this.getClass().getClassLoader().getResourceAsStream(resName);
        System.out.println("is1 = "+is1+" is2 = "+is2);

issues:
    is1 = java.io.BufferedInputStream@fedb902c is2 = null

2) How java.util.ResourceBundle class loads properties files without "/" at
the beginning? I have not seen they add this character!

Egor.

----- Original Message -----
From: "Jason Smith" <[EMAIL PROTECTED]>
To: "Orion-Interest" <[EMAIL PROTECTED]>
Sent: Friday, November 10, 2000 11:43 PM
Subject: RE: Properties


> I am assuming you are talking about a java.util.Property file here.  If
the
> class that wants to access the property file is bundled within a jar, you
> should try using the Class.getResource(String name) method.  Just remember
> if you put the properties in the root of the jar you need to specify the
> name you pass into getResource as "/<whatever.properties>".
>
> Sun has an article entitled "Accessing Resources in a Location-Independent
> Manner" you might want to check out.
> http://java.sun.com/j2se/1.3/docs/guide/resources/resources.html
>
> jason
>
>
>
>
>
>
>


Reply via email to