File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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

Properties file

Sasha McGrath

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: 378
Your question is a bit confusing..

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

Joined: Aug 16, 2005
Posts: 15087

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 8 API documentation
I agree. Here's the link:
subject: Properties file
It's not a secret anymore!