This is the mail archive of the java-discuss@sourceware.cygnus.com mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

ResourceBundle



A common usage of ResourceBundle.getBundle is for loading a properties
file (ie, getBundle will return a PropertyResourceBundle).  The string
passed to getBundle would look like "foo.bar.baz" and if the class
foo.bar.baz can't be found then it will look for the file
foo/bar/baz.properties in all the directories/jars specified in the
classpath.  Looking through the classpath like this is what
ClassLoader.getSystemResource* does.  The idea is you distribute your
app as a jar with files and images mixed in and they can be loaded via
the ClassLoader.

Of course none of this is mentioned in the 1.1 java docs for these
functions.  The 1.2 java docs do but these features are present in all
1.1 JDK's.

Implementing all this boils down to having a classpath to search for
these files.  I believe libgcj has all the pieces except a classpath.
One way to do this in libgcj would be to load the CLASSPATH
environment variable into the "java.class.path" System property (like
all JDK's do) and then have the ClassLoaders getResource functions use
that.

How's that sound?

Note that I'm not talking about the URL returning functions from
ClassLoader, I've never really understood those and probably aren't as
commonly used as the InputStream ones.

I need this functionality and am willing to implement it but since it
involves quite a bit of changes I thought I'd run it by everyone.

--
Tom Reilly
Allaire Corp.
http://www.allaire.com

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]