Wednesday, 17 December 2014

How to Install JAVA 7 (JDK 7u71) on RedHat 6/5

      During installation of Java using rpm and tar files I faced issues many times. After that I found a better way to install java from Sun site. We can also install multiple version of java easily if required.
Using below steps I have installed java successfully,

Step 1: Download Archive File
For 32 Bit –

              $ cd /usr/local/java

              $ 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/7u71-b14/jdk-7u71-linux-i586.tar.gz"

For 64 Bit –

             $ cd /usr/local/java

             $ 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/7u71-b14/jdk-7u71-linux-x64.tar.gz"

After completing download, Extract archive using following command. Use archive file as per your system configuration.
           
              $ tar -xzf jdk-7u71-linux-x64.tar.gz

Step 2: Setup Environment Variables

      After extracting java archive file, we just need to export the JAVA_HOME and AVA_BIN.  Most of java based application’s uses environment variables to work.
Use following commands to set up it.
Open .bash_profile from user home directory using following command copy the export JAVA_HOME path and save the .bash_profile and restart the putty session.

              $ vi .bash_profile
               export JAVA_HOME=/usr/local/java/jdk1.7.0_71
               PATH=$JAVA_HOME:$JAVA_HOME/bin:$PATH:$HOME/bin
               export PATH
Step 3: Check JAVA Version

Use following command to check which version of java is currently being used by system.
             
              # java -version

                      java version "1.7.0_71"
                      Java(TM) SE Runtime Environment (build 1.7.0_71-b14)
                      Java HotSpot(TM) 64-Bit Server VM (build 24.71-b01, mixed mode)

We are done with java installation on RedHat 6,  now we can start working with installed java.

For more information and reference check http://tecadmin.net/

No comments:

Post a Comment