How To Install openprops on CentOS 7

In this tutorial we learn how to install openprops on CentOS 7. openprops is An improved java.util.Properties from OpenJDK

Introduction

In this tutorial we learn how to install openprops on CentOS 7.

What is openprops

OpenProps is a tiny Java library which reads and writes .properties files using the same code as java.util.Properties from the OpenJDK, but enhanced so that it preserves the order of entries within the file, and it also preserves comments in the file. This means that a Properties editor or a file converter written to use OpenProps won’t have to lose comments or mess up the order of entries. By using OpenJDK code, OpenProps should handle all the old corner-cases in exactly the same way Java does. The handling of whitespace and comments is tested by a number of JUnit tests. But please let me know if you find a bug! Note the following differences from java.util.Properties 1. preserves comments and the order of entries in the file 2. storeToXml doesn’t use the Sun DTD (or any DTD) because it adds attributes for comments. 3. equals() and hashCode() won’t work the same way as with java.util.Properties, because they are no longer inherited from Hashtable. All you get is identity equality/hashcode. Also note that any header comment in the .properties file will be interpreted as a comment attached to the first message.

We can use yum or dnf to install openprops on CentOS 7. In this tutorial we discuss both methods but you only need to choose one of method to install openprops.

Install openprops on CentOS 7 Using yum

Update yum database with yum using the following command.

sudo yum makecache

After updating yum database, We can install openprops using yum by running the following command:

sudo yum -y install openprops

Install openprops on CentOS 7 Using dnf

If you don’t have dnf installed you can install DNF on CentOS 7 first. Update yum database with dnf using the following command.

sudo dnf makecache

After updating yum database, We can install openprops using dnf by running the following command:

sudo dnf -y install openprops

How To Uninstall openprops on CentOS 7

To uninstall only the openprops package we can use the following command:

sudo dnf remove openprops

References

Summary

In this tutorial we learn how to install openprops on CentOS 7 using yum and dnf.