日期:2014-05-16 浏览次数:20696 次
?
Red Hat Enterprise Linux 5 安装JDK
1、 在官网下载,我下载的是jdk-6u30-linux-i586-rpm.bin文件。放在/home目录下。
2、 先删除系统原先jdk1.4,系统自带jdk。用java –version查看系统自带jdk版本。
[root@localhost /]# rpm -qa | grep gcj
java-1.4.2-gcj-compat-1.4.2.0-40jpp.112
卸载命令
[root@localhost /]# rpm -e --nodeps java-1.4.2-gcj-compat-1.4.2.0-40jpp.112
3、 赋执行权限
[root@localhost home]# chmod +x jdk-6u30-linux-i586-rpm.bin
4、 执行安装
[root@localhost home]# ./jdk-6u30-linux-i586-rpm.bin
出现以下安装界面
Unpacking...
Checksumming...
Extracting...
UnZipSFX 5.50 of 17 February 2002, by Info-ZIP (Zip-Bugs@lists.wku.edu).
? inflating: jdk-6u30-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%]
?
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 Oracle products, services and training
* Access to early releases and documentation
?
Product and system data will be collected. If your configuration
supports a browser, the JDK Product Registration form 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.
安装成功,默认安装在/usr/java目录下。
5、 配置环境变量
[root@localhost home]# vi /etc/profile
打开文件后按i键,在文件最后插入以下配置
#JAVA
export JAVA_HOME=/usr/java/jdk1.6.0_30
export PATH=$PATH:$JAVA_HOME/bin:$JAVA_HOME/jre/bin
export CLASSPATH=.:$JAVA_HOME/lib:$JAVA_HOME/jre/lib:$CLASSPATH
按esc 键?
输入:wq 保存退出。?
再使配置生效 source /etc/profile