Alex Rivera | Logout

What is a .properties file and what does it contain?

Asked 2009-09-02T09:11:42.030
15

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.

Edit
Report

1 Answer

19

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.

answered 2009-09-02T09:17:59.957

Your Answer