What is and does a .properties file contain?

java, properties-file

Solution

A .properties file is a simple collection of key-value pairs that can be parsed by the `java.util.Properties` class.

Properties files are widely used for many purposes in all kinds of Java applications, often to store configuration or localization data.

ANT properties are an ANT-specific concept and not identical to properties files, though ANT properties can be read from such a file, usually in order to have a central point to store frequently used and changing configuration data. Then you can have a line like this in different ANT scripts:

<property file="foo.properties"/>

And all the scripts can then use those properties.

Problem

I want to know what is the use of .properties file and where it is used? Currently I am doing dynamic web application with ANT and I have to use a .properties file when I set a property inside the "build.xml" file.

Original source