1. 查找可用的jdk列表
    [[email protected] ~]# yum -y list java*
    出现以下列表

    Loaded plugins: security
    base                                                     | 3.7 kB     00:00     
    base/primary_db                                          | 4.6 MB     00:00     
    epel                                                     | 4.4 kB     00:00     
    epel/primary_db                                          | 6.7 MB     00:01     
    extras                                                   | 3.4 kB     00:00     
    extras/primary_db                                        |  26 kB     00:00     
    updates                                                  | 3.4 kB     00:00     
    updates/primary_db                                       | 1.3 MB     00:00     
    Available Packages
    java-1.5.0-gcj.x86_64                       1.5.0.0-29.1.el6             base   
    java-1.5.0-gcj-devel.x86_64                 1.5.0.0-29.1.el6             base   
    java-1.5.0-gcj-javadoc.x86_64               1.5.0.0-29.1.el6             base   
    java-1.5.0-gcj-src.x86_64                   1.5.0.0-29.1.el6             base   
    java-1.6.0-openjdk.x86_64                   1:1.6.0.36-1.13.8.1.el6_7    updates
    java-1.6.0-openjdk-demo.x86_64              1:1.6.0.36-1.13.8.1.el6_7    updates
    java-1.6.0-openjdk-devel.x86_64             1:1.6.0.36-1.13.8.1.el6_7    updates
    java-1.6.0-openjdk-javadoc.x86_64           1:1.6.0.36-1.13.8.1.el6_7    updates
    java-1.6.0-openjdk-src.x86_64               1:1.6.0.36-1.13.8.1.el6_7    updates
    java-1.7.0-openjdk.x86_64                   1:1.7.0.85-2.6.1.3.el6_7     updates
    java-1.7.0-openjdk-demo.x86_64              1:1.7.0.85-2.6.1.3.el6_7     updates
    java-1.7.0-openjdk-devel.x86_64             1:1.7.0.85-2.6.1.3.el6_7     updates
    java-1.7.0-openjdk-javadoc.noarch           1:1.7.0.85-2.6.1.3.el6_7     updates
    java-1.7.0-openjdk-src.x86_64               1:1.7.0.85-2.6.1.3.el6_7     updates
    java-1.8.0-openjdk.x86_64                   1:1.8.0.51-1.b16.el6_7       updates
    java-1.8.0-openjdk-debug.x86_64             1:1.8.0.51-1.b16.el6_7       updates
    java-1.8.0-openjdk-demo.x86_64              1:1.8.0.51-1.b16.el6_7       updates
    java-1.8.0-openjdk-demo-debug.x86_64        1:1.8.0.51-1.b16.el6_7       updates
    java-1.8.0-openjdk-devel.x86_64             1:1.8.0.51-1.b16.el6_7       updates
    java-1.8.0-openjdk-devel-debug.x86_64       1:1.8.0.51-1.b16.el6_7       updates
    java-1.8.0-openjdk-headless.x86_64          1:1.8.0.51-1.b16.el6_7       updates
    java-1.8.0-openjdk-headless-debug.x86_64    1:1.8.0.51-1.b16.el6_7       updates
    java-1.8.0-openjdk-javadoc.noarch           1:1.8.0.51-1.b16.el6_7       updates
    java-1.8.0-openjdk-javadoc-debug.noarch     1:1.8.0.51-1.b16.el6_7       updates
    java-1.8.0-openjdk-src.x86_64               1:1.8.0.51-1.b16.el6_7       updates
    java-1.8.0-openjdk-src-debug.x86_64         1:1.8.0.51-1.b16.el6_7       updates
    java-dirq.noarch                            1.4-1.el6                    epel   
    java-dirq-javadoc.noarch                    1.4-1.el6                    epel   
    java-sleep.noarch                           2.1-6.el6                    epel   
    java-sleep-javadoc.noarch                   2.1-6.el6                    epel   
    java_cup.x86_64                             1:0.10k-5.el6                base   
    java_cup-javadoc.x86_64                     1:0.10k-5.el6                base   
    java_cup-manual.x86_64                      1:0.10k-5.el6                base   
    javacc.x86_64                               4.1-0.5.el6                  base   
    javacc-demo.x86_64                          4.1-0.5.el6                  base   
    javacc-manual.x86_64                        4.1-0.5.el6                  base   
    javassist.noarch                            3.9.0-6.el6                  base   
    javassist-javadoc.noarch                    3.9.0-6.el6                  base   
    javastroke.x86_64                           0.5.1-24.el6                 epel   
    javatar.noarch                              2.5-5.el6                    epel   
    javatar-javadoc.noarch                      2.5-5.el6                    epel


  2. 安装,注意要在root权限下
    [[email protected] ~]yum -y install java-1.6.0-openjdk*
    这里1.6.0是版本号,换成你想安装的jdk版本就行。接下来等待自动下载和安装,无需配置环境变量

  3. 安装完后输入java -version
    如果出现类似于以下输出的话,就说明安装成功

    java version "1.8.0_25"
    Java(TM) SE Runtime Environment (build 1.8.0_25-b17)
    Java HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode)


赞助本站,网站的持续发展离不开你们的支持!一分也是爱ヾ(◍°∇°◍)ノ゙
 本文链接: ,花了好多脑细胞写的,转载请注明链接喔~~
登陆
      正在加载评论