• linux安装jdk


    方法二:用yum安装JDK

    1.查看yum库中都有哪些jdk版本(暂时只发现了openjdk)

    [root@localhost ~]# yum search java|grep jdk
    ldapjdk-javadoc.x86_64 : Javadoc for ldapjdk
    java-1.6.0-openjdk.x86_64 : OpenJDK Runtime Environment
    java-1.6.0-openjdk-demo.x86_64 : OpenJDK Demos
    java-1.6.0-openjdk-devel.x86_64 : OpenJDK Development Environment
    java-1.6.0-openjdk-javadoc.x86_64 : OpenJDK API Documentation
    java-1.6.0-openjdk-src.x86_64 : OpenJDK Source Bundle
    java-1.7.0-openjdk.x86_64 : OpenJDK Runtime Environment
    java-1.7.0-openjdk-demo.x86_64 : OpenJDK Demos
    java-1.7.0-openjdk-devel.x86_64 : OpenJDK Development Environment
    java-1.7.0-openjdk-javadoc.noarch : OpenJDK API Documentation
    java-1.7.0-openjdk-src.x86_64 : OpenJDK Source Bundle
    java-1.8.0-openjdk.x86_64 : OpenJDK Runtime Environment
    java-1.8.0-openjdk-demo.x86_64 : OpenJDK Demos
    java-1.8.0-openjdk-devel.x86_64 : OpenJDK Development Environment
    java-1.8.0-openjdk-headless.x86_64 : OpenJDK Runtime Environment
    java-1.8.0-openjdk-javadoc.noarch : OpenJDK API Documentation
    java-1.8.0-openjdk-src.x86_64 : OpenJDK Source Bundle
    ldapjdk.x86_64 : The Mozilla LDAP Java SDK

    2.选择版本,进行安装

    //选择1.7版本进行安装
    [root@localhost ~]# yum install java-1.7.0-openjdk
    //安装完之后,默认的安装目录是在: /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.75.x86_64

    3.设置环境变量

    [root@localhost ~]# vi /etc/profile

    在profile文件中添加如下内容

    #set java environment
    JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.75.x86_64
    JRE_HOME=$JAVA_HOME/jre
    CLASS_PATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib
    PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin
    export JAVA_HOME JRE_HOME CLASS_PATH PATH

    让修改生效

    [root@localhost java]# source /etc/profile

    4.验证JDK有效性

    [root@localhost java]# java -version
    java version "1.7.0_79"
    Java(TM) SE Runtime Environment (build 1.7.0_79-b15)
    Java HotSpot(TM) 64-Bit Server VM (build 24.79-b02, mixed mode)

  • 相关阅读:
    mysql详解9:触发器和事件
    mysql详解7:视图
    mysql详解6:字符串函数 日期函数 IF CASE
    mysql详解5:复杂查询
    [转]Kubernetes网络组件之Calico策略实践(BGP、RR、IPIP)
    Springcloud 学习笔记05-Mybatis-Plus
    Git学习笔记04--tortoisegit的clone、pull、commit操作、分支的新增、合并、删除
    Git学习笔记03--Git客户端(TortoiseGit)安装与基本使用
    Java 项目bug记录过程--Failed to configure a DataSource
    TiDB学习笔记02-场景案例综述
  • 原文地址:https://www.cnblogs.com/Baronboy/p/5951652.html
Copyright © 2020-2023  润新知