Installing Java on RHEL/CentOS

Installing java is essential for some services to run. Programs like confluence and elasticsearch require it to run. OpenJDK, which is the opensource version of Java and one of many Java Development Kits, is supported on RHEL and CentOS.

Open up a terminal session and lets install OpenJDK 1.8.0.

 yum install  java-1.8.0-openjdk-devel

Java will install on your system.  Use “java -version” to see what version you are currently running. You’re output will be similar to what mine looks like.

java -version

java version "1.8.0_171"
Java(TM) SE Runtime Environment (build 1.8.0_171-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.171-b11, mixed mode)

Finally,  RHEL comes with “alternatives”. It allows you to change between the different versions of OpenJDK.

yum install alternatives

Now that you have alternatives installed, you can use the following command to change between different versions.

/usr/sbin/alternatives --config java

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s