GeeCON Prague 2014*
The moose likes Servlets and the fly likes properties file using the ResourceBundle class? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Servlets
Bookmark "properties file using the ResourceBundle class?" Watch "properties file using the ResourceBundle class?" New topic
Author

properties file using the ResourceBundle class?

Ranjith Jain
Greenhorn

Joined: Aug 18, 2008
Posts: 4
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

Joined: Nov 06, 2000
Posts: 1510
Not a good idea to try to access a local drive from a web application. No guarantee the drive will exist.


Bosun (SCJP, SCWCD)
So much trouble in the world -- Bob Marley
Ranjith Jain
Greenhorn

Joined: Aug 18, 2008
Posts: 4
ok....
but can i place tht file under classpath.
Any help would be appreciated
vaib saxena
Greenhorn

Joined: Jul 13, 2009
Posts: 3
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

Joined: Jan 10, 2002
Posts: 61310
    
  66

I have removed the red color from your posts. Please use color sparingly and only for emphasis.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Ranjith Jain
Greenhorn

Joined: Aug 18, 2008
Posts: 4
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
 
GeeCON Prague 2014
 
subject: properties file using the ResourceBundle class?