How To Install Java JDK 8 on CentOS 7

Install Java JDK 8 on CentOS 7

There are many programs and scripts that require java to run it, but usually Java is not installed by default on VPS or Dedicated Server. This article assumes you have at least basic knowledge of linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple. I will show you through the step by step installation JAVA 8 (JDK 8u45) on CentOS 7.

Step 1. First, remove the Java 1.6 or 1.7 have been installed already, you can uninstall them using the following commands.

Step 2. Downloading latest Java archive.

At the time of writing this tutorial, the latest Java JDK version was JDK 8u45. First, let us download the latest Java SE Development Kit 8 release from its official download page or use following commands to download from shell:

Step 3. Install JAVA using alternatives.

After extracting archive file use alternatives command to install it. alternatives command is available in chkconfig package:

At this point JAVA 8 (JDK 8u45) has been successfully installed on your system. We also recommend to setup javac and jar commands path using alternatives:

Step 4. Checking Installed java version.

Step 5. Setup global environment variables.

We can easily set the environment variables using the export command as shown below:

Setup JAVA_HOME Variable:

Setup JRE_HOME Variable:

Setup PATH Variable:

Congratulation’s! You have successfully installed Java. Thanks for using this tutorial for installing Oracle Java (JDK) 8 on CentOS 7 system.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get a best deal!

Save