ResourceBundle

Can someone please explain to me what Resourcebundle is used for and how it's used?
[91 byte] By [newbie084a] at [2007-11-27 5:31:53]
# 1
If there only was a way to search the internet for a keyword.
Hippolytea at 2007-7-12 14:57:32 > top of Java-index,Java Essentials,Java Programming...
# 2
> If there only was a way to search the internet for a> keyword.I did that already. I'm trying to read a properties file. The javadoc doesnt really explain how to use it for this specific purpose
newbie084a at 2007-7-12 14:57:32 > top of Java-index,Java Essentials,Java Programming...
# 3
> I did that already. I'm trying to read a properties> file. The javadoc doesnt really explain how to use it> for this specific purposeThat's because you don't use a ResourceBundle to read a properties file.
DrClapa at 2007-7-12 14:57:32 > top of Java-index,Java Essentials,Java Programming...
# 4
what can I use to read it then?
newbie084a at 2007-7-12 14:57:32 > top of Java-index,Java Essentials,Java Programming...
# 5
Well, you can read a properties file with a ResourceBundle... Or you can use the Properties class.Or you can use a FileReader. read the API docs for them.
bsampieria at 2007-7-12 14:57:32 > top of Java-index,Java Essentials,Java Programming...
# 6

I always used ResourcedBundle to read *.properties like that:

ResourceBundle.getBundle("filename");

to get properties from "filename.properties".

the javadoc of ResourceBundle mentions "...PropertyResourceBundle uses a properties file to manage its resources...." so also have a look at the javadoc of PropertyResourceBundle.

[]

S_i_m_ua at 2007-7-12 14:57:32 > top of Java-index,Java Essentials,Java Programming...
# 7
thanx much
newbie084a at 2007-7-12 14:57:32 > top of Java-index,Java Essentials,Java Programming...
# 8

The biggest difference between a plain old Properties file and a ResourceBundle is that you can more easily deal with different Locales (so have different language) with ResourceBundles.

Take a look at the Internationalization tutorial found here http://java.sun.com/docs/books/tutorial/i18n/index.html

cotton.ma at 2007-7-12 14:57:32 > top of Java-index,Java Essentials,Java Programming...