What is a .properties file?
text/x-java-properties
A .properties file is the Java configuration format: one `key=value` or `key:value` pair per line, with `#` or `!` comments, backslash line continuations, and escapes for spaces, colons, and equals signs inside keys. Keys are conventionally dot-separated to imply hierarchy, though the format itself is flat. In its original definition the file is ISO-8859-1 with `\uXXXX` escapes for anything else; modern Java tooling also reads UTF-8.
How to use a .properties file
Use an example .properties file to test configuration and resource-bundle loaders, checking continuation lines, escaped separators inside keys, duplicate-key precedence, and correct decoding of `\uXXXX` escapes and non-ASCII values.
Download example .properties files
- Java ResourceBundle .properties — EnglishA English Java ResourceBundle with MessageFormat patterns, a ChoiceFormat plural, positional arguments, escaped braces and apostrophes, a backslash line continuation, and non-ASCII carried as \uXXXX escapes because .properties is defined as ISO-8859-1. The bytes on disk are pure ASCII.
- Java ResourceBundle .properties — GermanA German Java ResourceBundle with MessageFormat patterns, a ChoiceFormat plural, positional arguments, escaped braces and apostrophes, a backslash line continuation, and non-ASCII carried as \uXXXX escapes because .properties is defined as ISO-8859-1. The bytes on disk are pure ASCII.
- gradle.properties with Escapes and ContinuationsA gradle.properties exercising the .properties grammar rather than Gradle: a \uXXXX escape, a backslash line continuation, all three key/value separator forms, and a key containing escaped separator characters.
- Java Properties Parser Edge CasesThe .properties edge cases collected in one file: both comment markers, empty values, a value whose trailing spaces are significant, unescaped = and : inside values, a # that is not a comment, escape sequences, an escaped space in a key, and a duplicate key.