.properties
From Wikipedia, the free encyclopedia
Properties | |
File extension: | .properties |
---|---|
Type of format: | ASCII |
.properties is a file extension for files mainly used in Java related technologies to store the configurable parameters of an application.
.properties files can use the number sign (#) or the exclamation mark (!) to denote that all text following it is a comment. The backwards slash is used to escape a character. An example of a properties file is provided below.
# You are reading the ".properties" entry in the English wikipedia. ! The exclamation mark can also mark text as comments. website = http://en.wikipedia.org language = English # The backslash below tells the application to continue reading # the value onto the next line. message = Welcome to \ Wikipedia! # Add spaces to the key key\ with\ spaces = This is the value that could be looked up with the key "key with spaces".
A .properties file maps a key with a value and is essentially a hash table. In the example above, "website" would be a key, and its corresponding value would be "http://en.wikipedia.org". While the number sign and the exclamation mark marks text as comments, it has no effect when it is part of a property. Thus, the key "message" has the value "Welcome to Wikipedia!" and not "Welcome to Wikipedia". Note also that all of the whitespace in front of "Wikipedia!" is excluded completely.
[edit] See also
java.io.Properties.load(java.io.InputStream)
- gives the precise semantics of well-formed Java property files