This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Java in General and the fly likes How to change property file values using ResoureBundle Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "How to change property file values using ResoureBundle" Watch "How to change property file values using ResoureBundle" New topic
Author

How to change property file values using ResoureBundle

Naresh Talluri
Ranch Hand

Joined: Oct 12, 2007
Posts: 115
Hi All

I am reading one Property file ( applicationresource.proprties ) by using ResoureBundle.



here i have to set value of any one of key,
is that possible?
is that applicable through out application?
if not could you please advice any other solutions?

I really appriciate you if you have any solutions.

Really Thanks.

Naresh Talluri
Ranch Hand

Joined: Oct 12, 2007
Posts: 115
Can any one please help me.
salvin francis
Ranch Hand

Joined: Jan 12, 2009
Posts: 917

I would advise against editing properties files since these are usually text files that save the configuration of the systems.

basically properties files are plain simple text files,

here is how to edit a text file:
http://home.cogeco.ca/~ve3ll/jatutor9.htm

My Website: [Salvin.in] Cool your mind:[Salvin.in/painting] My Sally:[Salvin.in/sally]
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14074
    
  16

Class ResourceBundle doesn't have methods to change the values or save its content to a file. But you can read *.properties files with class java.util.Properties instead of class ResourceBundle; class Properties does have methods to change the content and save to a file. Look it up in the API documentation.

Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
Naresh Talluri
Ranch Hand

Joined: Oct 12, 2007
Posts: 115
Thank you for posting, lemme try with Proprties file and get back to you.
Again Thank you alot
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19654
    
  18

ResourceBundle usually reads resources. These are often located inside JAR files, and cannot be changed. That's why ResourceBundle has no methods for changing it.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to change property file values using ResoureBundle
 
Similar Threads
Replacing *.hbm.xml files with @Annotations.
Code to store null keys and null values in hashmap
Need help with inserting and displaying using HashMap
Assigning a Value in to String variable using JSTL
hashmaps to xml and back