Java环境:在Linux CentOS上yum安装JDK1.7原创

分类: 首页- >Java技术 | 阅读: 2024 | 评论: 0 | 2016-06-04 22:30:16 
摘要:如何使用yum方式在CentOS上安装Java环境,系统以CentOS6.4为例。本文讲述 Java环境:在Linux CentOS上yum安装JDK1.7的流程。
导读:Java环境:在Linux CentOS上yum安装JDK1.7。如何使用yum方式在CentOS上安装Java环境,系统以CentOS6.4为例。

一、查找JDK相关得列表:命令(yum -y list java*

[mbaike@localhost ~]$ yum -y list java*
Loaded plugins: fastestmirror
base | 1.1 kB 00:00
base/primary | 995 kB 00:00
base 2789/2789
extras | 2.1 kB 00:00
extras/primary_db | 164 kB 00:20
updates | 1.9 kB 00:00
updates/primary_db | 422 kB 00:01
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-5.1.13.3.el5_10 updates
java-1.6.0-openjdk-demo.i386 1:1.6.0.0-5.1.13.3.el5_10 updates
java-1.6.0-openjdk-devel.i386 1:1.6.0.0-5.1.13.3.el5_10 updates
java-1.6.0-openjdk-javadoc.i386 1:1.6.0.0-5.1.13.3.el5_10 updates
java-1.6.0-openjdk-src.i386 1:1.6.0.0-5.1.13.3.el5_10 updates
java-1.7.0-openjdk.i386 1:1.7.0.55-2.4.7.1.el5_10 updates
java-1.7.0-openjdk-demo.i386 1:1.7.0.55-2.4.7.1.el5_10 updates
java-1.7.0-openjdk-devel.i386 1:1.7.0.55-2.4.7.1.el5_10 updates
java-1.7.0-openjdk-javadoc.i386 1:1.7.0.55-2.4.7.1.el5_10 updates
java-1.7.0-openjdk-src.i386 1:1.7.0.55-2.4.7.1.el5_10 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 base

使用命令:yum -y list java*

二、安装JDK1.7:命令(yum -y install java-1.7.0-openjdk*)
[mbaike@localhost ~]$ yum -y install java-1.7.0-openjdk*
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirror.bit.edu.cn
* extras: mirror.bit.edu.cn
* updates: centos.ustc.edu.cn
base | 1.1 kB 00:00
base/primary | 995 kB 00:07
base 2789/2789
extras | 2.1 kB 00:00
extras/primary_db | 164 kB 00:02
updates | 1.9 kB 00:00
updates/primary_db | 422 kB 00:07
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package java-1.6.0-openjdk.i386 1:1.6.0.0-5.1.13.3.el5_10 set to be updated
--> Processing Dependency: jpackage-utils >= 1.7.3-1jpp.2 for package: java-1.6.0-openjdk
--> Processing Dependency: libgif.so.4 for package: java-1.6.0-openjdk
--> Processing Dependency: tzdata-java for package: java-1.6.0-openjdk
---> Package java-1.6.0-openjdk-demo.i386 1:1.6.0.0-5.1.13.3.el5_10 set to be updated
---> Package java-1.6.0-openjdk-devel.i386 1:1.6.0.0-5.1.13.3.el5_10 set to be updated
---> Package java-1.6.0-openjdk-javadoc.i386 1:1.6.0.0-5.1.13.3.el5_10 set to be updated
---> Package java-1.6.0-openjdk-src.i386 1:1.6.0.0-5.1.13.3.el5_10 set to be updated
--> Running transaction check
---> Package giflib.i386 0:4.1.3-7.3.3.el5 set to be updated
---> Package jpackage-utils.noarch 0:1.7.3-1jpp.3.el5 set to be updated
---> Package tzdata-java.i386 0:2014b-1.el5 set to be updated
--> Finished Dependency Resolution
Dependencies Resolved
================================================================================
Package Arch Version Repository
Size
================================================================================
Installing:
java-1.6.0-openjdk i386 1:1.6.0.0-5.1.13.3.el5_10 updates 44 M
java-1.6.0-openjdk-demo i386 1:1.6.0.0-5.1.13.3.el5_10 updates 2.2 M
java-1.6.0-openjdk-devel i386 1:1.6.0.0-5.1.13.3.el5_10 updates 15 M
java-1.6.0-openjdk-javadoc i386 1:1.6.0.0-5.1.13.3.el5_10 updates 20 M
java-1.6.0-openjdk-src i386 1:1.6.0.0-5.1.13.3.el5_10 updates 39 M
Installing for dependencies:
giflib i386 4.1.3-7.3.3.el5 base 39 k
jpackage-utils noarch 1.7.3-1jpp.3.el5 base 60 k
tzdata-java i386 2014b-1.el5 updates 172 k
Transaction Summary
================================================================================
Install 8 Package(s)
Upgrade 0 Package(s)
Total download size: 120 M
Downloading Packages:
(1/8): giflib-4.1.3-7.3.3.el5.i386.rpm | 39 kB 00:00
(2/8): jpackage-utils-1.7.3-1jpp.3.el5.noarch.rpm | 60 kB 00:00
(3/8): tzdata-java-2014b-1.el5.i386.rpm | 172 kB 00:04
(4/8): java-1.6.0-openjdk-demo-1.6.0.0-5.1.13.3.el5_10.i386.rpm | 2.2 MB 00:47
(5/8): java-1.6.0-openjdk-devel-1.6.0.0-5.1.13.3.el5_10.i386.rpm | 15 MB 04:25
(6/8): java-1.6.0-openjdk-javadoc-1.6.0.0-5.1.13.3.el5_10.i386.rpm (17%) 19% [============ ] 81 kB/s | 3.8 MB 03:19 ETA

使用命令 :yum -y install java-1.7.0-openjdk*

三、确认是否安装成功:命令(java -version
[mbaike@localhost ~]$ java -version
java version "1.7.0_30"
OpenJDK Runtime Environment (IcedTea6 1.13.3) (rhel-5.1.13.3.el5_10-i386)
OpenJDK Client VM (build 23.25-b01, mixed mode)

使用命令:java -version
正确显示了jdk版本信息就说明安装成功了。

四、卸载JDK1.7:命令(yum -y remove java-1.7.0-openjdk*
卸载JDK相关文件输入:yum -y remove java-1.7.0-openjdk*。

五、JDK1.7默认安装位置:
/usr/lib/jvm
由于我们得机器可能同时安装好几个版本得jdk,所以在/etc/alternatives目录下会有一个java链接到具体的java命令。而这个/etc/alternatives/java会被/usr/bin/java链接。从而java命令就被设置到了shell环境中。

 声明:www.mbaike.net 博客文章版权属于作者,受法律保护。未经作者同意不得转载。
标签 Java CentOS yum jdk
相关搜索

共有 0 条网友评论

还木有留言,还不抢沙发?

发布评论:

昵称: 邮箱: 验证码:
文明上网,理性发言!
© 移动互联百科(www.mbaike.net) | WAP站点 | 站长QQ:459104018 | 备案号:蜀ICP备14008230号-2