Introduction to .properties
The “.properties” is an extension mainly used for storing the configured parameters of the applications in the technologies related to the Java. This extension can also be used for storing the strings for the localization and internationalization. The parameters are stored as the pair of strings in which one is known as the key and other as the value.
The Properties File in Java is the collection of the pair of key-value that is used to handle the utility files like java.util.Properties. This file is used in mostly all types of Java applications that store the localization or the configured data.
Format of the Properties File
The format of the Properties File should be such that it is seamlessly read by the Nucleus and recognized by the java.util.Properties class. Here are some of the rules for the format.
- The Entries are expected to be written in the single line in the format like
– propertyName= propertyValue
– propertyName: propertyValue
- The White Space appearing between propertyName and the propertyValue is taken as ignored so both the Name and Value become equivalent to this example:
name = Stephen
Here, the White Space appearing, in the beginning, is overlooked
- At the end of the line, the property value is terminated but the White Space following it is not at all ignored but taken as the part of the ‘property Value’.
- These are ignored while writing the file format- the comment characters in the starting of the Lines like “!” and “#” and the Blank Lines.
- The characters newline is inserted with the character \n, the carriage return is inserted with the character \r and the tab is inserted with the character \t.
- The ‘property Value’ spans for the several lines if the ‘\’ Backlash character terminates these lines. Example:
Here in the above example, it goes equivalent to the targetCities= Detroit, Chicago and Los Angeles. Even the White Space at the beginning of these lines is also ignored.
- The UNICODE characters can be added similarly to the Java Program that uses the \u prefix. Example:- \u002c
Details of the Programs that open the Properties File
Here is the list of Programs that opens the Properties File in the Mac, Windows and the Linux.
- For Windows, the programs used to include Microsoft Notepad, Mojang Minecraft, and Other Windows text editors.
- In Linux, the program includes GNU Emacs, Mojang Minecraft, Other Linux related text editors and the Vim.
- For Mac, the programs that open this file format include Apple TextEdit, Mojang Minecraft and Other Text Editors inclusive in the Apple.
Tools for Editing the .properties File
There are many text editors present in various Operating Systems like Mac, Windows or Linux for editing the “.properties” file. Other third-party editing tools are also available with the added functionality like
- Creation of New Keys
- Data Validation
- Integrating with the Eclipse
- Synchronizing the key names
- Convert the bi-directional non-ASCII symbols to provide support to the non-Latin languages in this file format automatically