centos安装jdk

What

How


  1. 下载jdk http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html wget http://download.oracle.com/otn-pub/java/jdk/8u152-b16/aa0333dd3019491ca4f6ddbe78cdb6d0/jdk-8u152-linux-x64.tar.gz?AuthParam=1513491653_780a1246d58a066130a62b431b8be265

  2. 创建目录 mkdir -p /usr/local/java

  3. 将安装解压到该目录 tar -zxvf jdk-8u152-linux-x64.tar.gz -C /usr/local/java

  4. 配置环境变量 vi /etc/profile

    1
    2
    3
    4
    export JAVA_HOME=/usr/local/java/jdk1.8.0_152
    export JRE_HOME=$JAVA_HOME/jre
    export PATH=$PATH:$JAVA_HOME/bin
    export CLASSPATH=./:$JAVA_HOME/lib:$JAVA_HOME/jre/lib

  5. 使配置立即生效 source /etc/profile

  6. 验证是否配置正确 java -version

注意点

替换版本,

参考

http://blog.csdn.net/hu_wen/article/details/53817432

Juforg wechat
欢迎您扫一扫上面的微信公众号,订阅我的博客!