首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 操作系统 > UNIXLINUX >

Linux 升格 Java JDK

2012-07-02 
Linux 升级 Java JDKLinux 默认安装的 Java JDK 是 1.4.2 版本的,可从http://java.sun.com/javase/downloa

Linux 升级 Java JDK

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]#

?

热点排行