wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes Properties file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Properties file" Watch "Properties file" New topic
Author

Properties file

Sasha McGrath
Greenhorn

Joined: Jun 01, 2007
Posts: 10
I have a properties file and I have another file where I would like to have a method set a variable that is equal to the variable in the properties file. How would I do that?
Gamini Sirisena
Ranch Hand

Joined: Aug 05, 2008
Posts: 347
Your question is a bit confusing..

I hope it's only me..
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14074
    
  16

You can load the contents of a properties file with the load() method in class Properties:

Then you can use the Properties object to get and set the values. With the store() method (look it up in the API documentation) you can write the contents of the Properties object back to a file.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
 
jQuery in Action, 2nd edition
 
subject: Properties file
 
Similar Threads
Reading from a properties file for path declared in classpath
Creating a Properties file and calling them
Design issue in jsp
Reading Environment Variables
Properties file path hard coded