I have an application where I would like to make use of a ResourceBundle. I would like to use a .properties file but I'm not sure on the rules on where I can legally put the file. If I have a folder structure that looks like the following:
-- conf (contains all my configuration files) |- org.myapp (compiled class files)
I would ideally like my ServerResources_en.properties file to be in the conf folder. However, using the UIDefaults class in the javax.swing package, I can't get it load my resource properties file (either in the conf or org.myapps package). However, if I copy the source code of the UIDefaults class and create a UIDefaultsTest class in my project, then both approaches work. For example:
This works too:
Note: the AppDefaults class extends the UIDefaultTest class. But if my AppDefaults class extends the javax.swing.UIDefaults class, then everything fails. I suspect the classpath is at it again!
Per the ResourceBundle JavaDocs, it states:
Otherwise, getBundle attempts to locate a property resource file. It generates a path name from the candidate bundle name by replacing all "." characters with "/" and appending the string ".properties".
Bottom line: can I place a ResourceBundle properties file outside of my class package structure, and if so what's the best way to do it?
[ February 09, 2006: Message edited by: David Irwin ] [ February 09, 2006: Message edited by: David Irwin ]