美文网首页
Centos7安装OpenJDK8

Centos7安装OpenJDK8

作者: KotInstall | 来源:发表于2018-08-22 14:15 被阅读0次
        yum -y install java-1.8.0-openjdk java-1.8.0-openjdk-devel
    
        dirname $(readlink $(readlink $(which java)))
    

    【/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.181-3.b13.el7_5.x86_64/jre/bin】

    vim /etc/profile

       export JAVA_HOME=上面dirname命令获取到的路径,不要jre/bin最后这段
       export PATH=$PATH:$JAVA_HOME/bin
       export CLASSPATH=.:$JAVA_HOME/jre/lib:$JAVA_HOME/lib:$JAVA_HOME/lib/tools.jar
    

    保存退出文件,然后执行一下使设置立即生效

       source /etc/profile
    
       [root@iZm5e46125tswtbtri94d1Z ~]# java -version
       openjdk version "1.8.0_181"
       OpenJDK Runtime Environment (build 1.8.0_181-b13)
       OpenJDK 64-Bit Server VM (build 25.181-b13, mixed mode)
    

    相关文章

      网友评论

          本文标题:Centos7安装OpenJDK8

          本文链接:https://www.haomeiwen.com/subject/vkxyiftx.html