Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

properties file using the ResourceBundle class?

 
Ranjith Jain
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How do I access the values from a properties file using the ResourceBundle class?
Currently I have this properties file under \WEB-INF\classes and it works fine using the code

'ResourceBundle resourceBundle = ResourceBundle.getBundle("emailParameters");'

where "emailParameters.properties" is the name of the properties file.

I need to have the properties file outside the WEB-INF. I need to place it somewhere in the C:\.
How do I access this file using the ResourceBundle class?

[edit:removed color]


 
Bosun Bello
Ranch Hand
Posts: 1511
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not a good idea to try to access a local drive from a web application. No guarantee the drive will exist.
 
Ranjith Jain
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ok....
but can i place tht file under classpath.
Any help would be appreciated
 
vaib saxena
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Youp you can add the property file in the classpath.

Can i know are you using it into the web application with spring or another java standalone program
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65220
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have removed the red color from your posts. Please use color sparingly and only for emphasis.
 
Ranjith Jain
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok
How will access that file if i use getBundle method from ResourceBundle class
I am not using any framework.Just a core Java code
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic