CentOS7安装部署Java11

文章目录

  • CentOS7安装部署JDK11
  • 一、前言
  • 二、正文
    • 1.卸载 Open JDK
    • 2.安装JDK11

CentOS7安装部署JDK11

一、前言

  • Linux 发行版:CentOS-7-x86_64-DVD-1804.iso
  • JDK 版本:Java SE Development Kit 11.0.19

Java Archive:https://www.oracle.com/java/technologies/downloads/archive/

jdk11-archive-downloads:https://www.oracle.com/java/technologies/javase/jdk11-archive-downloads.html

[CentOS] JDK安装部署:https://blog.csdn.net/u011424614/article/details/94610567

Java环境变量配置过程:https://blog.csdn.net/u011424614/article/details/103530318

CentOS基础操作命令:https://blog.csdn.net/u011424614/article/details/94555916

二、正文

1.卸载 Open JDK

  • 查询原系统安装的 JDK
java -version

yum list installed | grep java
  • 根据原系统安装的 JDK 进行卸载命令修改
#--卸载openjdk 1.7
yum -y remove java-1.7.0-openjdk.x86_64
yum -y remove java-1.7.0-openjdk-headless.x86_64

#--卸载openjdk 1.8
yum -y remove java-1.8.0-openjdk.x86_64
yum -y remove java-1.8.0-openjdk-headless.x86_64

2.安装JDK11

  • 下载 JDK 压缩包,上传到服务器
  • 本文下载的版本:jdk-11.0.19_linux-x64_bin.tar.gz

jdk11-archive-downloads:https://www.oracle.com/java/technologies/javase/jdk11-archive-downloads.html

  • 创建安装目录,并解压
mkdir /opt/java
cd /opt/java
tar -zxvf jdk-11.0.19_linux-x64_bin.tar.gz
  • 编辑 /etc/profile
vim /etc/profile
  • 写入环境配置
export JAVA_HOME=/opt/java/jdk-11.0.19
export CLASSPATH=.:${JAVA_HOME}/jre/lib/rt.jar:${JAVA_HOME}/lib/tools.jar
export PATH=$PATH:${JAVA_HOME}/bin
  • 更改立即生效
source /etc/profile
  • 查看 JDK 版本
java -version

你可能感兴趣的:(#,CentOS,java,JDK,JDK11,java11)