Install and configure your own java in RedHat (RHEL) linux

Posted By: Matpal - June 19, 2017
Often you have to install your own Java on top of what Red Hat gives you. Here is the example how you can do it.

Step 1: Download JAVA 8  from here . In this example we are downloading jdk-8u131-linux-x64.tar.gz (64 Bit Linux)

Step 2 : Copy jdk-8u131-linux-x64.tar.gz to your file /opt manually, or try following

#  cd /opt/

#  wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" "http://download.oracle.com/otn-pub/java/jdk/8u131-b11/d54c1d3a095b4ff2b6607d096fa80163/jdk-8u131-linux-x64.tar.gz"

#  tar xzf jdk-8u131-linux-x64.tar.gz

Step 3:


#  cd /opt/jdk1.8.0_131/

#  alternatives --install /usr/bin/java   java   /opt/jdk1.8.0_131/bin/java  2

#  alternatives --config java

Step 4 : --config java gives you following . For your newly installed java enter 3


There are 3 programs which provide 'java'.

  Selection    Command
-----------------------------------------------
*  1           /usr/lib/jvm/jre-1.7.0-openjdk.x86_64/bin/java
   2           /usr/lib/jvm/jre-1.6.0-openjdk.x86_64/bin/java
 + 3           /opt/jdk1.8.0_131/bin/java

Enter to keep the current selection[+], or type selection number: 3



You can check your java version now

# java –version

0 comments:

Post a Comment

Note: Only a member of this blog may post a comment.