日期:2014-05-16 浏览次数:20707 次
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/j