Red Hat 5.4 安装JDK 1.6

 1、安装JDK  1.6

[root@localhost ~]# java -version
java version "1.4.2"
gij (GNU libgcj) version 4.1.2 20080704 (Red Hat 4.1.2-46)

Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

说明本机安装的是1.4版本的JDK,下面执行卸载操作。

[root@localhost ~]# rpm -qa|grep gcj
libgcj-devel-4.1.2-46.el5
libgcj-src-4.1.2-46.el5
java-1.4.2-gcj-compat-src-1.4.2.0-40jpp.115
libgcj-4.1.2-46.el5
java-1.4.2-gcj-compat-devel-1.4.2.0-40jpp.115
java-1.4.2-gcj-compat-1.4.2.0-40jpp.115

输入  rpm -e java-1.4.2-gcj-compat-1.4.2.0-40jpp.115 ,报错如下:

error: Failed dependencies:
        java-gcj-compat >= 1.0.31 is needed by (installed) tomcat5-servlet-2.4-api-5.5.23-0jpp.7.el5_3.2.i386
        java-gcj-compat >= 1.0.31 is needed by (installed) tomcat5-jsp-2.0-api-5.5.23-0jpp.7.el5_3.2.i386
        java-gcj-compat >= 1.0.64 is needed by (installed) gjdoc-0.7.7-12.el5.i386
        java-gcj-compat is needed by (installed) junit-3.8.2-3jpp.1.i386
        java-gcj-compat is needed by (installed) jakarta-commons-codec-1.3-7jpp.2.i386
        java-gcj-compat is needed by (installed) antlr-2.7.6-4jpp.2.i386
        java-gcj-compat is needed by (installed) jakarta-commons-logging-1.0.4-6jpp.1.i386
        java-gcj-compat is needed by (installed) jakarta-commons-httpclient-3.0-7jpp.1.i386
        java-gcj-compat is needed by (installed) xalan-j2-2.7.0-6jpp.1.i386
        java-gcj-compat is needed by (installed) bsf-2.3.0-11jpp.1.i386
        java-gcj-compat is needed by (installed) bsh-1.3.0-9jpp.1.i386
        java-gcj-compat is needed by (installed) xmlrpc-2.0.1-3jpp.1.i386
        jaxp_parser_impl is needed by (installed) xalan-j2-2.7.0-6jpp.1.i386
        java-1.4.2-gcj-compat = 0:1.4.2.0-40jpp.115 is needed by (installed) java-1.4.2-gcj-compat-src-1.4.2.0-40jpp.115.i386
        java-1.4.2-gcj-compat = 0:1.4.2.0-40jpp.115 is needed by (installed) java-1.4.2-gcj-compat-devel-1.4.2.0-40jpp.115.i386
        /usr/bin/rebuild-gcj-db is needed by (installed) eclipse-ecj-3.2.1-19.el5.i386

加入参数--nodeps,再次输入

[root@localhost ~]# rpm -e --nodeps java-1.4.2-gcj-compat-1.4.2.0-40jpp.115
[root@localhost ~]# rpm -e --nodeps java-1.4.2-gcj-compat-devel-1.4.2.0-40jpp.115
[root@localhost ~]# rpm -e --nodeps java-1.4.2-gcj-compat-src-1.4.2.0-40jpp.115
卸载还有java字段的软件包。

查看java 版本

[root@localhost ~]# java -version
-bash: /usr/bin/java: No such file or directory

卸载完成,下面执行安装过程。

我们需要找到JDK 1.6的下载链接:http://www.oracle.com/technetwork/java/javasebusiness/downloads/java-archive-downloads-javase6-419409.html

出处:http://stackoverflow.com/questions/3731133/where-can-i-download-jdk-1-6u20-64-bit

选择Java SE Development Kit 6u45 版本,我们选择第一个下载包:

 Linux x8665.46 MB   jdk-6u45-linux-i586-rpm.bin

赋予可执行权限

[root@localhost Desktop]# ls
jdk-6u45-linux-i586-rpm.bin
[root@localhost Desktop]# chmod +x jdk-6u45-linux-i586-rpm.bin

执行文件:

[root@localhost Desktop]# ./jdk-6u45-linux-i586-rpm.bin
Unpacking...
Checksumming...
Extracting...
UnZipSFX 5.50 of 17 February 2002, by Info-ZIP (Zip-Bugs@lists.wku.edu).
  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 Desktop]# 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)



安装结束。

参考:http://orax.blog.sohu.com/188672709.html

         http://www.linuxidc.com/Linux/2010-11/29913.htm




  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值