File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Abilities of ResourceBundle

 
zaeem masood ashar
Ranch Hand
Posts: 54
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
Can anyone tell me the how the ResourceBundle of the Java.util package accesses properties from a .properties file?? What exactly happens??
Thanks
 
rani bedi
Ranch Hand
Posts: 358
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
check the API at http://java.sun.com/j2se/1.3/docs/api/index.html
Suppose we have a PropertyResourceBundle 'test.properties'. This ResourceBundle contains the keys 'key1' and 'key2'.
try
{
ResourceBundle resb = ResourceBundle.getBundle(test);
String keyValue1 = (String)resb.getObject(this.key1);
String keyValue2 = (String)resb.getObject(this.key2);
}
catch(MissingResourceException e)
{
e.printStackTrace();
}
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic