How to Install Java 7 (JDK 7u65) on CentOS/RHEL 6/5


Install Java 7 (JDK 7u65) on CentOS/RHEL 6/5

Step 1: Download Archive File

Download latest version of java from http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html.

For 64 Bit –
# cd /opt/
# wget http://download.oracle.com/otn-pub/java/jdk/7u67-b01/jdk-7u67-linux-x64.tar.gz?AuthParam=1410461115_7bfe6685f15c82dcaaedb31561201f2b

Note: In any case if above command failed to download and you need to download java through Linux terminal, watch below screen cast ( http://screencast.com/t/wf9bQ0XjDPxT ), You are required a graphical browser.

After completing download, Extract archive using following command. Use archive file as per your system configuration. For this example we are using 32 bit machine.

# tar -zxvf jdk-7u67-linux-x64.gz

Step 2: Install JAVA using Alternatives

After extracting java archive file, we just need to set up to use newer version of java using alternatives. Use the following commands to do it.

# cd /opt/jdk1.7.0_65/
# alternatives --install /usr/bin/java java /opt/jdk1.7.0_65/bin/java 2
# alternatives --config java

There are 4 programs which provide 'java'.

  Selection    Command
-----------------------------------------------
*  1           /usr/lib/jvm/jre-1.6.0-openjdk/bin/java
 + 2           /opt/jdk1.7.0_55/bin/java
   3           /opt/jdk1.7.0_60/bin/java
   4           /opt/jdk1.7.0_65/bin/java

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

Now you may also required to setup javac and jar commands path using alternatives

# alternatives --install /usr/bin/jar jar /opt/jdk1.7.0_65/bin/jar 2
# alternatives --install /usr/bin/javac javac /opt/jdk1.7.0_65/bin/javac 2
# alternatives --set jar /opt/jdk1.7.0_65/bin/jar
# alternatives --set javac /opt/jdk1.7.0_65/bin/javac
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_65"
Java(TM) SE Runtime Environment (build 1.7.0_65-b17)
Java HotSpot(TM) Client VM (build 24.60-b09, mixed mode)


Step 4: Setup Environment Variables

Most of java based application’s uses environment variables to work. Use following commands to set up it.

Setup JAVA_HOME Variable
# export JAVA_HOME=/opt/jdk1.7.0_65
Setup JRE_HOME Variable
# export JRE_HOME=/opt/jdk1.7.0_65/jre
Setup PATH Variable
# export PATH=$PATH:/opt/jdk1.7.0_65/bin:/opt/jdk1.7.0_65/jre/bin

---- DONE,Thanks ----

1 comments:

How To Install Java 7 (Jdk 7U65) On Centos/Rhel 6/5 - Sample Blog >>>>> Download Now

>>>>> Download Full

How To Install Java 7 (Jdk 7U65) On Centos/Rhel 6/5 - Sample Blog >>>>> Download LINK

>>>>> Download Now

How To Install Java 7 (Jdk 7U65) On Centos/Rhel 6/5 - Sample Blog >>>>> Download Full

>>>>> Download LINK