Install JDK on CentOS step by step

In this tutorial, How to Install JDK on CentOS step by step. How to switch between JDK 7 and JDK 8?

Precondition

  1. Open the terminal and log in as root or you use sudo before each command with another user.
  2. Working on a Linux system operating: Centos/REHL

Search for JDK on CentOS

You use the command below to search the packages

$ yum search openjdk

The output terminal console as below

Install jdk on Centos step by step

Install JDK 1.8

$ sudo yum install java-1.8.0-openjdk

Confirmation is complete when the installed Java version is displayed.

$ java --version
# Output
# openjdk version "1.8.0_212"
# OpenJDK Runtime Environment (build 1.8.0_212-b04)
# OpenJDK 64-Bit Server VM (build 25.212-b04, mixed mode)

How to switch JDK 7 to JDK 8

Use command “sudo alternatives –config java” to switch for JDK.

How to switch JDK 7 to JDK 8

How to switch JDK 8 to JDK 7

How to switch JDK 8 to JDK 7

Conclusion

Thought the article,  How to Install JDK on CentOS step by step. How to switch between JDK 7 and JDK 8? as above. I hope will this your helpful. Thank you for reading the DevopsRoles page!

,

About HuuPV

My name is Huu. I love technology and especially Devops Skill such as Docker, vagrant, git so forth. I likes open-sources. so I created DevopsRoles.com site to share the knowledge that I have learned. My Job: IT system administrator. Hobbies: summoners war game, gossip.
View all posts by HuuPV →

3 thoughts on “Install JDK on CentOS step by step

Leave a Reply

Your email address will not be published.

Comment moderation is enabled. Your comment may take some time to appear.

This site uses Akismet to reduce spam. Learn how your comment data is processed.