File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Joined: Jun 01, 2007
Sep 15, 2008 20:39:00
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?
Joined: Aug 05, 2008
Sep 15, 2008 22:17:00
Your question is a bit confusing..
I hope it's only me..
Jesper de Jong
Joined: Aug 16, 2005
Sep 16, 2008 01:10:00
You can load the contents of a properties file with the load() method in class Properties:
Properties props = new Properties(); InputStream in = new FileInputStream("myfile.properties"); props.load(in); in.close();
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
- My blog about Scala
I agree. Here's the link:
subject: Properties file
Reading Environment Variables
Reading from a properties file for path declared in classpath
Design issue in jsp
Creating a Properties file and calling them
Properties file path hard coded
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014