文档章节

在linux上使用yum安装JDK

罗荣熙
 罗荣熙
发布于 2015/05/04 16:52
字数 1565
阅读 1389
收藏 6

1.查找java相关得列表 [root@localhost ~]# yum -y list java* Loaded plugins: fastestmirror, refresh-packagekit, security Loading mirror speeds from cached hostfile

  • base: mirrors.zju.edu.cn
  • extras: mirrors.aliyun.com
  • updates: mirrors.aliyun.com base | 3.7 kB 00:00
    extras | 3.4 kB 00:00
    updates | 3.4 kB 00:00
    Installed Packages java-1.5.0-gcj.x86_64 1.5.0.0-29.1.el6 @base/$releasever java-1.6.0-openjdk.x86_64 1:1.6.0.0-1.45.1.11.1.el6 @base/$releasever java_cup.x86_64 1:0.10k-5.el6 @base/$releasever Available Packages 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.35-1.13.7.1.el6_6 updates
    java-1.6.0-openjdk-demo.x86_64 1:1.6.0.35-1.13.7.1.el6_6 updates
    java-1.6.0-openjdk-devel.x86_64 1:1.6.0.35-1.13.7.1.el6_6 updates
    java-1.6.0-openjdk-javadoc.x86_64 1:1.6.0.35-1.13.7.1.el6_6 updates
    java-1.6.0-openjdk-src.x86_64 1:1.6.0.35-1.13.7.1.el6_6 updates
    java-1.7.0-openjdk.x86_64 1:1.7.0.79-2.5.5.1.el6_6 updates
    java-1.7.0-openjdk-demo.x86_64 1:1.7.0.79-2.5.5.1.el6_6 updates
    java-1.7.0-openjdk-devel.x86_64 1:1.7.0.79-2.5.5.1.el6_6 updates
    java-1.7.0-openjdk-javadoc.noarch 1:1.7.0.79-2.5.5.1.el6_6 updates
    java-1.7.0-openjdk-src.x86_64 1:1.7.0.79-2.5.5.1.el6_6 updates
    java-1.8.0-openjdk.x86_64 1:1.8.0.45-28.b13.el6_6 updates
    java-1.8.0-openjdk-demo.x86_64 1:1.8.0.45-28.b13.el6_6 updates
    java-1.8.0-openjdk-devel.x86_64 1:1.8.0.45-28.b13.el6_6 updates
    java-1.8.0-openjdk-headless.x86_64 1:1.8.0.45-28.b13.el6_6 updates
    java-1.8.0-openjdk-javadoc.noarch 1:1.8.0.45-28.b13.el6_6 updates
    java-1.8.0-openjdk-src.x86_64 1:1.8.0.45-28.b13.el6_6 updates
    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

2.使用root用户安装 安装时提醒必须使用root用户,sudo都不行。 [root@localhost ~]# yum -y install java-1.7.0-openjdk* Loaded plugins: fastestmirror, refresh-packagekit, security Loading mirror speeds from cached hostfile

  • base: mirrors.zju.edu.cn
  • extras: mirrors.aliyun.com
  • updates: mirrors.aliyun.com Setting up Install Process Resolving Dependencies --> Running transaction check ---> Package java-1.7.0-openjdk.x86_64 1:1.7.0.79-2.5.5.1.el6_6 will be installed --> Processing Dependency: libjpeg.so.62(LIBJPEG_6.2)(64bit) for package: 1:java-1.7.0-openjdk-1.7.0.79-2.5.5.1.el6_6.x86_64 ---> Package java-1.7.0-openjdk-demo.x86_64 1:1.7.0.79-2.5.5.1.el6_6 will be installed ---> Package java-1.7.0-openjdk-devel.x86_64 1:1.7.0.79-2.5.5.1.el6_6 will be installed ---> Package java-1.7.0-openjdk-javadoc.noarch 1:1.7.0.79-2.5.5.1.el6_6 will be installed ---> Package java-1.7.0-openjdk-src.x86_64 1:1.7.0.79-2.5.5.1.el6_6 will be installed --> Running transaction check ---> Package libjpeg.x86_64 0:6b-46.el6 will be obsoleted ---> Package libjpeg-turbo.x86_64 0:1.2.1-3.el6_5 will be obsoleting --> Finished Dependency Resolution

Dependencies Resolved

================================================================================ Package Arch Version Repository Size

Installing: java-1.7.0-openjdk x86_64 1:1.7.0.79-2.5.5.1.el6_6 updates 26 M java-1.7.0-openjdk-demo x86_64 1:1.7.0.79-2.5.5.1.el6_6 updates 1.9 M java-1.7.0-openjdk-devel x86_64 1:1.7.0.79-2.5.5.1.el6_6 updates 9.4 M java-1.7.0-openjdk-javadoc noarch 1:1.7.0.79-2.5.5.1.el6_6 updates 16 M java-1.7.0-openjdk-src x86_64 1:1.7.0.79-2.5.5.1.el6_6 updates 39 M libjpeg-turbo x86_64 1.2.1-3.el6_5 base 174 k replacing libjpeg.x86_64 6b-46.el6

Transaction Summary

Install 6 Package(s)

Total download size: 92 M Downloading Packages: (1/6): java-1.7.0-openjdk-1.7.0.79-2.5.5.1.el6_6.x86_64. | 26 MB 02:44
(2/6): java-1.7.0-openjdk-demo-1.7.0.79-2.5.5.1.el6_6.x8 | 1.9 MB 00:10
(3/6): java-1.7.0-openjdk-devel-1.7.0.79-2.5.5.1.el6_6.x | 9.4 MB 01:23
(4/6): java-1.7.0-openjdk-javadoc-1.7.0.79-2.5.5.1.el6_6 | 16 MB 02:16
(5/6): java-1.7.0-openjdk-src-1.7.0.79-2.5.5.1.el6_6.x86 | 39 MB 04:23
(6/6): libjpeg-turbo-1.2.1-3.el6_5.x86_64.rpm | 174 kB 00:00

Total 143 kB/s | 92 MB 11:03
warning: rpmts_HdrFromFdno: Header V3 RSA/SHA1 Signature, key ID c105b9de: NOKEY Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6 Importing GPG key 0xC105B9DE: Userid : CentOS-6 Key (CentOS 6 Official Signing Key) centos-6-key@centos.org Package: centos-release-6-3.el6.centos.9.x86_64 (@base/$releasever) From : /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6 Running rpm_check_debug Running Transaction Test Transaction Test Succeeded Running Transaction Installing : libjpeg-turbo-1.2.1-3.el6_5.x86_64 1/7 Installing : 1:java-1.7.0-openjdk-1.7.0.79-2.5.5.1.el6_6.x86_64 2/7 Installing : 1:java-1.7.0-openjdk-src-1.7.0.79-2.5.5.1.el6_6.x86_64 3/7 Installing : 1:java-1.7.0-openjdk-demo-1.7.0.79-2.5.5.1.el6_6.x86_64 4/7 Installing : 1:java-1.7.0-openjdk-devel-1.7.0.79-2.5.5.1.el6_6.x86_64 5/7 Installing : 1:java-1.7.0-openjdk-javadoc-1.7.0.79-2.5.5.1.el6_6.noarch 6/7 Erasing : libjpeg-6b-46.el6.x86_64 7/7 Verifying : 1:java-1.7.0-openjdk-src-1.7.0.79-2.5.5.1.el6_6.x86_64 1/7 Verifying : 1:java-1.7.0-openjdk-1.7.0.79-2.5.5.1.el6_6.x86_64 2/7 Verifying : 1:java-1.7.0-openjdk-javadoc-1.7.0.79-2.5.5.1.el6_6.noarch 3/7 Verifying : 1:java-1.7.0-openjdk-demo-1.7.0.79-2.5.5.1.el6_6.x86_64 4/7 Verifying : 1:java-1.7.0-openjdk-devel-1.7.0.79-2.5.5.1.el6_6.x86_64 5/7 Verifying : libjpeg-turbo-1.2.1-3.el6_5.x86_64 6/7 Verifying : libjpeg-6b-46.el6.x86_64 7/7

Installed: java-1.7.0-openjdk.x86_64 1:1.7.0.79-2.5.5.1.el6_6
java-1.7.0-openjdk-demo.x86_64 1:1.7.0.79-2.5.5.1.el6_6
java-1.7.0-openjdk-devel.x86_64 1:1.7.0.79-2.5.5.1.el6_6
java-1.7.0-openjdk-javadoc.noarch 1:1.7.0.79-2.5.5.1.el6_6
java-1.7.0-openjdk-src.x86_64 1:1.7.0.79-2.5.5.1.el6_6
libjpeg-turbo.x86_64 0:1.2.1-3.el6_5

Replaced: libjpeg.x86_64 0:6b-46.el6

Complete!

3.确认是否安装成功

[root@localhost ~]# java -version java version "1.7.0_79" OpenJDK Runtime Environment (rhel-2.5.5.1.el6_6-x86_64 u79-b14) OpenJDK 64-Bit Server VM (build 24.79-b02, mixed mode) [root@localhost ~]# javac Usage: javac <options> <source files> where possible options include: -g Generate all debugging info -g:none Generate no debugging info -g:{lines,vars,source} Generate only some debugging info -nowarn Generate no warnings -verbose Output messages about what the compiler is doing -deprecation Output source locations where deprecated APIs are used -classpath <path> Specify where to find user class files and annotation processors -cp <path> Specify where to find user class files and annotation processors -sourcepath <path> Specify where to find input source files -bootclasspath <path> Override location of bootstrap class files -extdirs <dirs> Override location of installed extensions -endorseddirs <dirs> Override location of endorsed standards path -proc:{none,only} Control whether annotation processing and/or compilation is done. -processor <class1>[,<class2>,<class3>...] Names of the annotation processors to run; bypasses default discovery process -processorpath <path> Specify where to find annotation processors -d <directory> Specify where to place generated class files -s <directory> Specify where to place generated source files -implicit:{none,class} Specify whether or not to generate class files for implicitly referenced files -encoding <encoding> Specify character encoding used by source files -source <release> Provide source compatibility with specified release -target <release> Generate class files for specific VM version -version Version information -help Print a synopsis of standard options -Akey[=value] Options to pass to annotation processors -X Print a synopsis of nonstandard options -J<flag> Pass <flag> directly to the runtime system -Werror Terminate compilation if warnings occur @<filename> Read options and filenames from file

[root@localhost ~]# java Usage: java [-options] class [args...] (to execute a class) or java [-options] -jar jarfile [args...] (to execute a jar file) where options include: -d32 use a 32-bit data model if available -d64 use a 64-bit data model if available -server to select the "server" VM The default VM is server.

-cp <class search path of directories and zip/jar files>
-classpath <class search path of directories and zip/jar files>
              A : separated list of directories, JAR archives,
              and ZIP archives to search for class files.
-D<name>=<value>
              set a system property
-verbose:[class|gc|jni]
              enable verbose output
-version      print product version and exit
-version:<value>
              require the specified version to run
-showversion  print product version and continue
-jre-restrict-search | -no-jre-restrict-search
              include/exclude user private JREs in the version search
-? -help      print this help message
-X            print help on non-standard options
-ea[:<packagename>...|:<classname>]
-enableassertions[:<packagename>...|:<classname>]
              enable assertions with specified granularity
-da[:<packagename>...|:<classname>]
-disableassertions[:<packagename>...|:<classname>]
              disable assertions with specified granularity
-esa | -enablesystemassertions
              enable system assertions
-dsa | -disablesystemassertions
              disable system assertions
-agentlib:<libname>[=<options>]
              load native agent library <libname>, e.g. -agentlib:hprof
              see also, -agentlib:jdwp=help and -agentlib:hprof=help
-agentpath:<pathname>[=<options>]
              load native agent library by full pathname
-javaagent:<jarpath>[=<options>]
              load Java programming language agent, see java.lang.instrument
-splash:<imagepath>
              show splash screen with specified image

See http://www.oracle.com/technetwork/java/javase/documentation/index.html for more details.

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

© 著作权归作者所有

共有 人打赏支持
罗荣熙
粉丝 27
博文 118
码字总数 84709
作品 0
广州
程序员
私信 提问
linux在线安装JDK(1.8版本)

linux在线安装JDK(1.8版本) 2018年07月03日 15:36:27 唯爱酒神 阅读数:806 标签: linux jdk安装 jdk安装 更多 个人分类: linux 在线下载JDK 命令: wget --no-check-certificate --no-c...

rootliu
02/22
0
0
阿里云centos6.6 服务器环境配置(不定期更新)

阿里云centos6.6 服务器环境配置(不定期更新) 查看CentOS版本 lsb_release -a 一:安装JDK步骤 1.查看是否存在jdk java -version 或者 rpm -qa|grep jdk 2.卸载jdk rpm -e xxx 3.查看系统信...

swayer
2015/11/12
0
2
linux下安装jdk失败怎么办?

linux下安装jdk失败怎么办?有小伙伴在linux下安装jdk时遇到安装失败的问题,下文介绍linux安装jdk图文教程,一起来了解下吧!linux安装jdk图文教程: 有时出于需要(比如安装最新的 eclipse ...

问题终结者
2017/11/06
0
0
转 CentOS卸载OpenJDK并安装Sun JDK

CentOS卸载OpenJDK并安装Sun JDK 分类: linux2012-07-23 06:40 7153人阅读 评论(1) 收藏 举报 centosjdksunjava终端build 第一步:查看Linux自带的JDK是否已安装 (卸载centOS已安装的1.4)...

grail
2014/06/30
0
0
CentOS6.3+JDK7+Tomcat7.0+MySQL5.5 开发环境的搭建

第一步:安装CentOS6.3 关于安装教程,本文没有附上,请自行解决! 附上下载地址:http://www.centos.org (官网下载) 第二步:安装JDK7(jdk-7u7-linux-x64-rpm.bin) 1.在安装之前要卸载自...

罗荣熙
2012/09/20
0
2

没有更多内容

加载失败,请刷新页面

加载更多

Hibernate SQLite方言

以下代码有参考过github上国外某位大佬的,在发文的最新稳定版Hibernate上是可用的,有时间再仔细分析一下 import org.hibernate.dialect.Dialect;import org.hibernate.dialect.function.S...

CHONGCHEN
今天
3
0
CentOS 7 MariaDB搭建主从服务器

本文编写环境为CentOS7。确保关闭SELinux,关闭防火墙或者防打开指定端口。具体信息如下 #master[root@promote ~]# cat /etc/redhat-release CentOS Linux release 7.6.1810 (Core) [r...

白豆腐徐长卿
今天
10
0
介绍python中运算符优先级

下面这个表给出Python的运算符优先级,从最低的优先级(最松散地结合)到最高的优先级(最紧密地结合)。这意味着在一个表达式中,Python会首先计算表中较下面的运算符,然后在计算列在表上部...

问题终结者
今天
3
0
Spring Boot 2.x基础教程:快速入门

简介 在您第1次接触和学习Spring框架的时候,是否因为其繁杂的配置而退却了?在你第n次使用Spring框架的时候,是否觉得一堆反复黏贴的配置有一些厌烦?那么您就不妨来试试使用Spring Boot来让...

程序猿DD
昨天
10
0
SpringSecurity认证流程源码级详解

SpringSecurity认证流程源码级详解 认证流程说明 认证结果如何在多个请求之间共享 获取认证用户信息

chendom
昨天
2
0

没有更多内容

加载失败,请刷新页面

加载更多

返回顶部
顶部