CentOS上yum安装JDK – 孩子 要努力啊 – 博客频道 – CSDN.NET

为了搭建测试环境

1 在vmware 下安装了x86-64-bit的linux

2 新建虚拟机中选择 iso,然后一路next

3 root登入新的虚拟机

4 查看有无安装jdk命令:#java -version

5 yum安装jdk

 

首先,我们来看看yum库是否有java安装包

[root@233797 www.ctohome.com]yum -y list java*

Loaded plugins: fastestmirror

Loading mirror speeds from cached hostfile

 * base: mirror.grikare.com

 * extras: centos.mirror.facebook.net

 * rpmforge: ftp-stud.fht-esslingen.de

 * updates: mirror.grikare.com

Excluding Packages in global exclude list

Finished

Available Packages

java-1.4.2-gcj-compat.i386                                                              1.4.2.0-40jpp.115                                                                base   

java-1.4.2-gcj-compat-devel.i386                                                        1.4.2.0-40jpp.115                                                                base   

java-1.4.2-gcj-compat-javadoc.i386                                                      1.4.2.0-40jpp.115                                                                base   

java-1.4.2-gcj-compat-src.i386                                                          1.4.2.0-40jpp.115                                                                base   

java-1.6.0-openjdk.i386                                                                 1:1.6.0.0-1.23.1.9.10.el5_7                                                      updates

java-1.6.0-openjdk-demo.i386                                                            1:1.6.0.0-1.23.1.9.10.el5_7                                                      updates

java-1.6.0-openjdk-devel.i386                                                           1:1.6.0.0-1.23.1.9.10.el5_7                                                      updates

java-1.6.0-openjdk-javadoc.i386                                                         1:1.6.0.0-1.23.1.9.10.el5_7                                                      updates

java-1.6.0-openjdk-src.i386                                                             1:1.6.0.0-1.23.1.9.10.el5_7                                                      updates

java_cup.i386                                                                           1:0.10-0.k.6jpp.1                                                                base   

java_cup-javadoc.i386                                                                   1:0.10-0.k.6jpp.1                                                                base   

java_cup-manual.i386                                                                    1:0.10-0.k.6jpp.1                                                                base   

javacc.i386                                                                             4.0-3jpp.3                                                                       base   

javacc-demo.i386                                                                        4.0-3jpp.3                                                                       base   

javacc-manual.i386                                                                      4.0-3jpp.3     

 

然后我们安装java1.6.x,怎样使用yum安装java? 怎么用yum安装jdk?

[root@233797 www.ctohome.com]yum -y install  java-1.6.0-openjdk*

 

查看yum安装java的结果,安装完成后,执行java -version

[root@233797 www.ctohome.com]java -version

java version “1.6.0_20”

OpenJDK Runtime Environment (IcedTea6 1.9.10) (rhel-1.23.1.9.10.el5_7-i386)

OpenJDK Client VM (build 19.0-b09, mixed mode)

 

6 安装成功

7 如安装不成功,参见http://www.idcus.net/show.asp?id=34

来源URL:http://blog.csdn.net/onepiecehuiyu/article/details/17189571