Troubleshooting

   

Finding the .properties Files

I've defined a properties file, but my application can't find the file when the getResourceBundle method is called.

When using .properties files for your resource bundles, make sure they are in your system CLASSPATH. Otherwise, you will get a MissingResourceException when calling the getBundle method on the ResourceBundle class. Because the key/value pairs are loaded dynamically, there is no way for the compiler to check to see if you are referencing invalid keys. When you call the getObject or getString methods on a ResoureBundle, you might also get a MissingResourceException. You should handle this by always having a default value for the key.

   


Special Edition Using Java 2 Standard Edition
Special Edition Using Java 2, Standard Edition (Special Edition Using...)
ISBN: 0789724685
EAN: 2147483647
Year: 1999
Pages: 353

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net