RHEL 6 安装 JDK 6U45 (rmp方式)

[edgen@localhost ~]$ mkdir /opt/JDK6
mkdir: 无法创建目录"/opt/JDK6": 权限不够
[edgen@localhost ~]$ su
密码:
[root@localhost edgen]# mkdir /opt/JDK6
[root@localhost edgen]# cp ~edgen/Desktop/jdk-6u45-linux-i586-rpm.bin /opt/JDK6
[root@localhost edgen]# cd /opt/JDK6
[root@localhost JDK6]# ll
总用量 67032
-rwxr--r--. 1 root root 68637258  1月 12 17:10 jdk-6u45-linux-i586-rpm.bin
[root@localhost JDK6]# ./jdk-6u45-linux-i586-rpm.bin
Unpacking...
Checksumming...
Extracting...
UnZipSFX 5.50 of 17 February 2002, by Info-ZIP ([email protected]).
  inflating: jdk-6u45-linux-i586.rpm 
  inflating: sun-javadb-common-10.6.2-1.1.i386.rpm 
  inflating: sun-javadb-core-10.6.2-1.1.i386.rpm 
  inflating: sun-javadb-client-10.6.2-1.1.i386.rpm 
  inflating: sun-javadb-demo-10.6.2-1.1.i386.rpm 
  inflating: sun-javadb-docs-10.6.2-1.1.i386.rpm 
  inflating: sun-javadb-javadoc-10.6.2-1.1.i386.rpm 
Preparing...                ########################################### [100%]
   1:jdk                    ########################################### [100%]
Unpacking JAR files...
 rt.jar...
 jsse.jar...
 charsets.jar...
 tools.jar...
 localedata.jar...
 plugin.jar...
 javaws.jar...
 deploy.jar...
Installing JavaDB
Preparing...                ########################################### [100%]
   1:sun-javadb-common      ########################################### [ 17%]
   2:sun-javadb-core        ########################################### [ 33%]
   3:sun-javadb-client      ########################################### [ 50%]
   4:sun-javadb-demo        ########################################### [ 67%]
   5:sun-javadb-docs        ########################################### [ 83%]
   6:sun-javadb-javadoc     ########################################### [100%]
 
Done.
[root@localhost JDK6]# ll
总用量 134520
-rw-r--r--. 1 root root 58463270  3月 26 2013 jdk-6u45-linux-i586.rpm
-rwxr--r--. 1 root root 68637258  1月 12 17:10 jdk-6u45-linux-i586-rpm.bin
-rw-r--r--. 1 root root   499375 11月  2 2010 sun-javadb-client-10.6.2-1.1.i386.rpm
-rw-r--r--. 1 root root    14627 11月  2 2010 sun-javadb-common-10.6.2-1.1.i386.rpm
-rw-r--r--. 1 root root  4080625 11月  2 2010 sun-javadb-core-10.6.2-1.1.i386.rpm
-rw-r--r--. 1 root root   969861 11月  2 2010 sun-javadb-demo-10.6.2-1.1.i386.rpm
-rw-r--r--. 1 root root  4865183 11月  2 2010 sun-javadb-docs-10.6.2-1.1.i386.rpm
-rw-r--r--. 1 root root   201273 11月  2 2010 sun-javadb-javadoc-10.6.2-1.1.i386.rpm
[root@localhost JDK6]# rpm -ivh jdk-6u45-linux-i586.rpm
Preparing...                ########################################### [100%]
 package jdk-2000:1.6.0_45-fcs.i586 is already installed
[root@localhost JDK6]# /usr/java/jdk1.6.0_45/bin/java -version
java version "1.6.0_45"
Java(TM) SE Runtime Environment (build 1.6.0_45-b06)
Java HotSpot(TM) Client VM (build 20.45-b01, mixed mode, sharing)
[root@localhost JDK6]# java -version
java version "1.6.0_45"
Java(TM) SE Runtime Environment (build 1.6.0_45-b06)
Java HotSpot(TM) Client VM (build 20.45-b01, mixed mode, sharing)
[root@localhost JDK6]# vi /etc/profile
[root@localhost JDK6]# cat /etc/profile | grep JAVA_HOME
JAVA_HOME=/usr/java/jdk1.6.0_45
CLASSPATH=$JAVA_HOME/lib/tools.jar
PATH=$JAVA_HOME/bin;$PATH
export JAVA_HOME CLASSPATH PATH
[root@localhost edgen]# echo $JAVA_HOME

[root@localhost edgen]# source /etc/profile
[root@localhost edgen]# echo $JAVA_HOME
/usr/java/jdk1.6.0_45
[edgen@localhost ~]$ source /etc/profile
[edgen@localhost ~]$ echo $JAVA_HOME
/usr/java/jdk1.6.0_45
[edgen@localhost ~]$ reboot

你可能感兴趣的:(Linux)