By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,789 Members | 1,215 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,789 IT Pros & Developers. It's quick & easy.

Get the path of Property file and read data from the same

P: 1
Hi

I have created a property file in java and placed the same inside the WEB-INF folder. How can i access the full path of the property file inside my src code and how will i read the data from the same file?

If i made any changes to the above file it will affect when i stop the server and again start it. is there any other methods to get the changes without stopping/starting the server?

Could anyone please help me on this ?

Thanks in advance
Apr 17 '12 #1
Share this Question
Share on Google+
1 Reply


10K+
P: 13,264
Put the file on the application classpath (WEB-INF/classes) and then you can load it using
[code=java]Class.getResourceAsStream ("/package/name/nameOfFile.properties");[/java]

or if it's a resource bundle
Expand|Select|Wrap|Line Numbers
  1. ResourceBundle.getBundle("package.name.nameOfFile");
  2.  
Apr 18 '12 #2

Post your reply

Sign in to post your reply or Sign up for a free account.