Loading

Centos配置Oracle JAVA环境

  1. 下载JAVA jdk的安装包
    下载地址: https://www.oracle.com/java/technologies/downloads/
# pwd
/usr/local/src
  1. 解压安装包
    解压二进制文件并设置软连接
# tar -xvf jdk-8u241-linux-x64.tar.gz
# ln -sv /usr/local/src/jdk1.8.0_241 /usr/local/jdk
  1. 配置环境变量
# vim /etc/profile
export JAVA_HOME=/usr/local/jdk
export PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH
export CLASSPATH=.$CLASSPATH:$JAVA_HOME/lib:$JAVA_HOME/jre/lib:$JAVA_HOME/lib/tools.jar
  1. 加载配置文件
source  /etc/profile
  1. 验证JAVA版本
java version "1.8.0_241"
Java(TM) SE Runtime Environment (build 1.8.0_241-b07)
  1. Centos安装openjdk
yum search java|grep jdk
yum install java-11-openjdk.x86_64
java -version
posted @ 2021-03-09 13:13  梨花海棠  阅读(178)  评论(0编辑  收藏  举报