Step 1: Download Archive File
Download latest version of java from http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html.
# cd /opt/
# wget http://download.oracle.com/otn-pub/java/jdk/7u25-b15/jdk-7u25-linux-i586.tar.gz?AuthParam=1372657186_d532b6d28fdb7f35ec7150a1d6df6778
After completing download, Extract archive using following command.
After completing download, Extract archive using following command.
# tar xzf jdk-7u25-linux-i586.tar.gz
Step 2: Install JAVA using Alternatives
After extracting java archive file, we just need to setup to use newer version of java using alternatives. Use the following commands to do it.
Step 2: Install JAVA using Alternatives
After extracting java archive file, we just need to setup to use newer version of java using alternatives. Use the following commands to do it.
# cd /opt/jdk1.7.0_25
# alternatives --install /usr/bin/java java /opt/jdk1.7.0_25/bin/java 2
# alternatives --config java
There is 1 program that provides 'java'.
Selection Command
-----------------------------------------------
*+ 1 /opt/jdk1.7.0_25/bin/java
Enter to keep the current selection[+], or type selection number: 1
Step 3: Check Version of JAVA .
Step 3: Check Version of JAVA .
# java -version
java version "1.7.0_25" Java(TM) SE Runtime Environment (build 1.7.0_25-b15) Java HotSpot(TM) Client VM (build 23.25-b01, mixed mode)
Step 4: Setup Environment Variables
Most of java based application’s uses environment variables to work. Use following commands to setup it.
Setup JAVA_HOME Variable
# export JAVA_HOME=/opt/jdk1.7.0_25
Setup JRE_HOME Variable
Setup JRE_HOME Variable
# export JRE_HOME=/opt/jdk1.7.0_25/jre
Setup PATH Variable
Setup PATH Variable
# export PATH=$PATH:/opt/jdk1.7.0_25/bin:/opt/jdk1.7.0_25/jre/bin