wood burning stoves 2.0*
The moose likes Servlets and the fly likes Correct location of language properties bundle files Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Servlets
Bookmark "Correct location of language properties bundle files" Watch "Correct location of language properties bundle files" New topic
Author

Correct location of language properties bundle files

Vadim Vararu
Ranch Hand

Joined: Jan 03, 2009
Posts: 147
Hi everyone. I'm reading a little bit about resource bundles and i would like to ask where is the correct location of the .properties files?
I tried to put them in the WEB-INF path, but i receive and exception. It works only when i put .properties file somewhere in my class packages.

Is it possible to put them in other places than WEB-INF/class/beginningFromHere ???


If you think you've done too much, usually it means you've done too few.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61310
    
  66

If they are being loaded by the class loader, the anywhere in the classpath will do.

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Vadim Vararu
Ranch Hand

Joined: Jan 03, 2009
Posts: 147
Bear Bibeault wrote:If they are being loaded by the class loader, the anywhere in the classpath will do.


Is a property file when used as a parameter in ResourceBundle.getBundle(path_to_property_file) loaded by classloader?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61310
    
  66

The answer is very evident in the JavaDoc for that class and method.
Vadim Vararu
Ranch Hand

Joined: Jan 03, 2009
Posts: 147
- Gets a resource bundle using the specified base name, the default locale, and the caller's class loader.

What's so evident. Looking first time at that, i can't understand, can i put "baseName" property file in other place than where classpath is delcared?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61310
    
  66

You asked if the class loader was used. The last part of that sentence makes it evident.
 
GeeCON Prague 2014
 
subject: Correct location of language properties bundle files