Linux安装JAVA JDK

  1. 作者QQ:67065435 QQ群:821635552

安装JAVA_JDK准备

  1. 检查是否安装JDK

    rpm -qa|grep -E '^open[jre|jdk]|j[re|dk]'
    
  2. 卸载已安装JDK

    rpm -qa|grep Java|xargs rpm -e --nodeps
    

YUM安装JAVA_JDK

  1. yum安装jdk

    yum search java|grep jdk
    yum install java-1.8.0-openjdk
    
  2. 环境变量配置

    vim /etc/profile
    
    export JRE_HOME=$JRE_HOME:/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.212.b04-0.el7_6.x86_64/jre
    export JAVA_HOME=$JAVA_HOME:/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.212.b04-0.el7_6.x86_64
    export CLASSPATH=$CLASSPATH:$JAVA_HOME/lib:$JRE_HOME/lib
    export PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin
    
    ESC
    :wq
    
  3. 检查安装是否成功

    java -version
    
    java version "1.8.0_101"
    Java(TM) SE Runtime Environment (build 1.8.0_101-b13)
    Java HotSpot(TM) 64-Bit Server VM (build 25.101-b13, mixed mode)
    

源码安装JAVA_JDK

  1. 命令行下载 JDK8

    cd /root
    wget --no-check-certificate --no-cookies \
    --header "Cookie:oraclelicense=accept-securebackup-cookie" \
    http://download.oracle.com/otn-pub/java/jdk/8u131-b13/jdk-8u131-linux-x64.tar.gz
    
  2. 解压并配置环境变量

    tar -zxvf jdk-8u131-linux-x64.tar.gz
    mv /root/jdk1.8.0_101 /usr/local/jdk
    
    vim /etc/profile
    
    export JAVA_HOME=$JAVA_HOME:/usr/local/jdk
    export JRE_HOME=$JRE_HOME:/usr/local/jdk/jre
    export CLASSPATH=$CLASSPATH:$JAVA_HOME/lib:$JRE_HOME/lib
    export PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin
    
    ESC
    :wq
    
    source /etc/profile
    
  3. 检查安装是否成功

    java -version
    
    java version "1.8.0_101"
    Java(TM) SE Runtime Environment (build 1.8.0_101-b13)
    Java HotSpot(TM) 64-Bit Server VM (build 25.101-b13, mixed mode)
    
Copyright © 豆包嘿嘿~ 2012-∞ 冀ICP备17033181号 all right reserved,powered by Gitbook修订: 2012-12-31 12:00:00

results matching ""

    No results matching ""