Java Properties Files  (Definition)

A properties file is a simple text file.  You can create and maintain a properties file with just about any text editor.

You should always create a default properties file.  The name of this file begins with the base name of your resource bundle and ends with the suffix ".PROPERTIES."  For example, a properties file can contain the following lines:

# ---------------------------------------------------------------------

# This is the default file

STR_ID1 = computer

STR_ID2 = diskFILE = file


# ---------------------------------------------------------------------

Note that in the preceding file the comment lines begin with a pound sign (#).  The other lines contain key-value pairs.  The key is on the left side of the equal sign, the value is on the right.  For instance, "s2" is the key that corresponds to the value disk.  The key is arbitrary.  "s2" could have been called something else, such as "msg5" or "diskID."  However, once defined, the key should not be changed because it is referenced in the source code.  The values may be changed; in fact, the values will be translated into various languages when localizers create new properties files to accommodate additional languages.