linux 安装 java

109 篇文章 0 订阅

Linux 默认安装的 Java JDK 是 1.4.2 版本的,可从http://java.sun.com/javase/downloads/index.jsp 下载最新的 JDK 1.6 (Java 新起了个名叫 JDK 6) ,并按下面方法进行升级:

 

一、安装新的 JDK (注意红字为用户输入的)

[root@catdb java]# 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.

[root@catdb java]# pwd

/software/java

[root@catdb java]# ls

jdk-6u18-linux-x64-rpm.bin

[root@catdb java]# ./jdk-6u18-linux-x64-rpm.bin

Sun Microsystems, Inc. Binary Code License Agreement

for the JAVA SE DEVELOPMENT KIT (JDK), VERSION 6

......

1. DEFINITIONS. "Software" means the identified above in

......

Do you agree to the above license terms? [yes or no]

yes

Unpacking...

Checksumming...

Extracting...

UnZipSFX 5.50 of 17 February 2002, by Info-ZIP (Zip-Bugs@lists.wku.edu).

  inflating: jdk-6u18-linux-amd64.rpm 

  inflating: sun-javadb-common-10.5.3-0.2.i386.rpm 

  inflating: sun-javadb-core-10.5.3-0.2.i386.rpm 

  inflating: sun-javadb-client-10.5.3-0.2.i386.rpm 

  inflating: sun-javadb-demo-10.5.3-0.2.i386.rpm 

  inflating: sun-javadb-docs-10.5.3-0.2.i386.rpm 

  inflating: sun-javadb-javadoc-10.5.3-0.2.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%]

Java(TM) SE Development Kit 6 successfully installed.

Product Registration is FREE and includes many benefits:

* Notification of new versions, patches, and updates

* Special offers on Sun products, services and training

* Access to early releases and documentation

Product and system data will be collected. If your configuration

supports a browser, the Sun Product Registration form for

the JDK will be presented. If you do not register, none of

this information will be saved. You may also register your

JDK later by opening the register.html file (located in

the JDK installation directory) in a browser.

For more information on what data Registration collects and

how it is managed and used, see:

http://java.sun.com/javase/registration/JDKRegistrationPrivacy.html

Press Enter to continue.....

 

Done.

 

二、配置新的环境变量

[root@catdb java]# vi /etc/profile

最配置文件最后加入下面变量:

# for java jdk6

export JAVA_HOME=/usr/java/jdk1.6.0_18

export PATH=$JAVA_HOME/bin:$PATH

export CLASSPATH=.:$JAVA_HOME/lib/tools.jar

 

三、重启系统或用下面命令让新环境变量立即生效:

[root@catdb java]# source /etc/profile

[root@catdb java]# java -version

java version "1.6.0_18"

Java(TM) SE Runtime Environment (build 1.6.0_18-b07)

Java HotSpot(TM) 64-Bit Server VM (build 16.0-b13, mixed mode)

[root@catdb java]#

 

 

 

另外需要设置jre请参考

 

http://eryk.iteye.com/blog/800686

 

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

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值