2014年6月30日月曜日

How to Install Java 7(JDK 7u60) On RHEL 6

Step1 Download File
http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html
#tar xzf jdk-7u60-linux-x64.gz

Step2 Install JAVA using Alternatives
#cd /home/oracle/alice/jdk1.7.0_60
#[oracle@infbjvm1XX jdk1.7.0_60]$ sudo -i
[root@infbjvm1XX ~]# alternatives --install /usr/bin/java java /home/oracle/alice/jdk1.7.0_60/bin/java 2
[root@infbjvm1XX ~]# alternatives --config java
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           /home/oracle/alice/jdk1.7.0_60/bin/java
Enter to keep the current selection[+], or type selection number: 3
#

Now you may also required to setup javac and jar commands path using alternatives:
[root@infbjvm1XX ~]# alternatives --install /usr/bin/jar jar /home/oracle/alice/jdk1.7.0_60/bin/java
[root@infbjvm1XX ~]# alternatives --install /usr/bin/javac javac /home/oracle/alice/jdk1.7.0_60/bin/java
[root@infbjvm1XX ~]# set jar /home/oracle/alice/jdk1.7.0_60/bin/java
[root@infbjvm1XX ~]# set javac /home/oracle/alice/jdk1.7.0_60/bin/javac

Step3 Check JAVA Version
# java -version
java version "1.7.0_60"
Java(TM) SE Runtime Environment (build 1.7.0_60-b19)
Java HotSpot(TM) 64-Bit Server VM (build 24.60-b09, mixed mode)

Step4 Setup Environment Variables
export JAVA_HOME=/home/oracle/alice/jdk1.7.0_60/
export JRE_HOME=/home/oracle/alice/jdk1.7.0_60/jre
export PATH=$PATH:/home/oracle/alice/jdk1.7.0_60/bin:/home/oracle/alice/jdk1.7.0_60/jre/bin

0 件のコメント :

コメントを投稿