File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Correct location of language properties bundle files

 
Vadim Vararu
Ranch Hand
Posts: 147
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ???
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64173
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If they are being loaded by the class loader, the anywhere in the classpath will do.
 
Vadim Vararu
Ranch Hand
Posts: 147
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64173
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The answer is very evident in the JavaDoc for that class and method.
 
Vadim Vararu
Ranch Hand
Posts: 147
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
- 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
Pie
Posts: 64173
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You asked if the class loader was used. The last part of that sentence makes it evident.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic