OpenJDK is a Java implementation and compilation platform that is open source. After installing this platform, you will be able to run or develop software written in Java programming language. It has two different versions that we must first examine before installing:
- OpenJDK JRE: The platform acts like a virtual machine on your CentOS, also called JVM, and provides the ability to run Java applications for the CentOS operating system.
- OpenJDK JDK: This version of OpenJDK is designed for developers and dual-core developers to provide them with the ability to install Java applications as well as install JRE on the platform during installation.
In this tutorial we will show how to install both the aforementioned versions. If you wish to install only one of them, follow the steps specified for that version.
Please Note: The commands described in this tutorial work on Centos 7, 6, 5, and Fedora. To install the OpenJDK platform, you must have root access on your operating system. If you use another root user with an access token, enter the sudo command before executing the commands.
Install OpenJDK JRE in CentOS
To install the JRE version of the OpenJDK platform, enter the following command:
yum install -y java-1.7.0-openjdk
Keep in mind that the version installed with the above command is version 7 of this platform. If you want to install version 6, you must enter the following command:
yum install -y java-1.6.0-openjdk
Install OpenJDK JDK in CentOS
To install the JDK version, enter the following command:
yum install -y java-1.7.0-openjdk-devel
This way, you will be able to install JDK version 7 for dual-core. If you intend to install version 6, enter the following command instead:
yum install -y java-1.6.0-openjdk-devel