Loading configuration parameters from textfile into a program

Loading parameters into a program is easily handled in Java through the Properties class.
The only thing that has to be done is to create an instance of the Properties class and one instance of
FileInputStream class that points to the configuration file.
The actual loading of the parameters are done through the method load() on the Properties object.
In the example below parameters are read from the configuration file and then printed out.

This is what the sample configuration file looks like:

This is the output after printing out the loaded configuration parameters:

Search for more Java info on this site here:
Custom Search

Please type any questions here.