October 2011
Beginner
432 pages
10h 18m
English
Java programs are more versatile when they can be configured using command-line arguments, as you have demonstrated in several applications created in preceding hours. The java.util package includes a class, Properties, that enables configuration settings to be loaded from another source: a text file.
The file can be read like other file sources in Java:
• Create a File object that represents the file.
• Create a FileInputStream object from that File object.
• Call load() to retrieve the properties from that input stream.
A properties file has a set of property names followed by an equal sign (=) and their values. Here’s an example:
username=leptonlastCommand=open databasewindowSize=32
Each property ...
Read now
Unlock full access