ArticleslgStudy

computer science

.properties

.properties is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand .properties rather than just read about it. In short: .properties is a file extension for files mainly used in Java-related technologies to store the configurable parameters of an application. They can also be used for storing strings for Internationalization and localization; these are known as Property Resource Bundles.

Key takeaways

  • .properties belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect .properties to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of .properties from memory before moving on to harder problems.

Reference excerpt

.properties is a file extension for files mainly used in Java-related technologies to store the configurable parameters of an application. They can also be used for storing strings for Internationalization and localization; these are known as Property Resource Bundles. Each parameter is stored as a pair of strings, one storing the name of the parameter (called the key), and the other storing the value. Unlike many popular file formats, there is no RFC for .properties files and specification documents are not always clear, most likely due to the simplicity of the format.

Format Each line in a .properties file normally stores a single property. Several formats are possible for each line, including key=value, key = value, key:value, and key value. Single-quotes or double-quotes are considered part of the string. Trailing space is significant and presumed to be trimmed as required by the consumer. Comment lines in .properties files are denoted by the number sign (#) or the exclamation mark (!) as the first non blank character, in which all remaining text on that line is ignored. The backwards slash is used to escape a character. An example of a properties file is provided below.

In the example above:

the number sign (#) and the exclamation mark (!) at the beginning of a line (line 1, 2, etc), marks text as comments and comments they are ignored, an empty line (line 5) is also ignored, "website" (line 8) would be a key, and its corresponding value would be "https://en.wikipedia.org/", all of the whitespace at the beginning of line 44 is excluded. This means that the key "welcome" (line 43) has the value "Welcome to Wikipedia!" and not "Welcome to Wikipedia!". Java provides the java.util.Properties class to parse a .properties file at runtime. Before Java 9, the encoding of a .properties file is ISO-8859-1, also known as Latin-1. All non-ASCII characters must be entered by using Unicode escape characters, e.g. \uHHHH where HHHH is a hexadecimal index of the character in the Unicode character set. This allows for using .properties files as resource bundles for localization. A non-Latin-1 text file can be converted to a correct .properties file by using the native2ascii tool that is shipped with the JDK or by using a tool, such as po2prop, that manages the transformation from a bilingual localization format into .properties escaping. An alternative to using unicode escape characters for non-Latin-1 character in ISO 8859-1 character encoded Java *.properties files is to use the JDK's XML Properties file format which by default is UTF-8 encoded, introduced starting with Java 1.5. Another alternative is to create custom control that provides custom encoding. In Java 9 and newer, the default encoding specifically for property resource bundles is UTF-8, and if an invalid UTF-8 byte sequence is encountered it falls back to ISO-8859-1.

Editing Editing .properties files is done using any text editor such as those typically installed on various Operating Systems including Notepad on Windows or Emacs, Vim, etc. on Linux systems. Third-party tools are also available with additional functionality specific to editing .properties files such as:

Data Validation Creating new keys Synchronization of key names Automatic bi-directional conversion of non-ASCII symbols to support non-Latin languages Integration with Eclipse

Non-Java uses and exceptions Apache Flex uses .properties files as well, but here they are UTF-8 encoded. In Apache mod_jk's uriworkermap.properties format, an exclamation mark ("!") denotes a Negation operator when used as the first non blank character in a line. Perl CPAN contains Config::Properties to interface to a .properties file. SAP uses .properties files for localization within their framework SAPUI5 and its open-source variant OpenUI5 There are many Node.js (JavaScript/TypeScript) options available on Npm's package manager. PHP also has many package options available.

See also XML, JSON and YAML are used by some for more complex configuration formats.

References

External links java.util.Properties.load(java.io.Reader) - gives the precise semantics of well-formed Java property files java.util.PropertyResourceBundle - describes property resource bundles java.util.Properties - explains Java properties in a simple XML format. MultiProperties - It is an Eclipse plugin for editing multiple key-value based files with similar content. This kind of file format can be Properties for example in Java programming language, which is frequently used for backing a ResourceBundle. Bracket Properties - a refresh of the Properties concept while keeping the ubiquitous .properties file format intact. Java Properties Editor (Application + Eclipse plugin) - useful utility to view and to edit properties files in a whole project. DOKSoft Properties Editor Eclipse plugin Archived 2014-07-28 at the Wayback Machine - i18n tool for installing into Eclipse IDE. Message Editor - it manages i18n for Java application. It generates XML property files. It includes two stylesheets for .properties and .xml property generation at compile time (Ant based.) JLokalize - open source Java properties editor with reversal function and spell check Config::Properties - Perl CPAN. Jackson Properties module is a library that allows mapping Properties file contents into Java Objects and back, similar to how XML and JSON is commonly mapped SAPUI5 - Use of Localized Texts in Applications

Worked examples

Example 1 — a first encounter with .properties

Start with the simplest possible case. Write down what .properties claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to .properties before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about .properties ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of .properties

In research
.properties appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses .properties in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
.properties is common in secondary-school and first-year university syllabi. It links to neighbouring topics Computer file formats, Configuration files, Filename extensions, so understanding it makes those chapters shorter.
In everyday life
Look for .properties outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “.properties” →

How to study .properties in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what .properties means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain .properties out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is .properties in simple terms?

.properties is a file extension for files mainly used in Java-related technologies to store the configurable parameters of an application. They can also be used for storing strings for Internationalization and localization; these are known as Property Resource Bundles.

Why does .properties matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study .properties?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on .properties.

Tags

  • Computer file formats
  • Configuration files
  • Filename extensions
  • Java (programming language)

Keep exploring