Administrator
发布于 2023-07-18 / 104 阅读
0
0

Jdk 11 Install & Configure

Windows Install

refer to : https://access.redhat.com/documentation/en-us/openjdk/11/html/installing_and_using_openjdk_11_for_windows/installing_openjdk_msi_installer

Linux Install

refer to : https://access.redhat.com/documentation/en-us/openjdk/11/html/installing_and_using_openjdk_11_on_rhel/installing-openjdk11-on-rhel8#installing-jdk11-on-rhel-using-archive_openjdk

1.Create a directory to where you want to download the archive file, and then navigate to that directory on your command-line interface (CLI).

cd /opt
mkdir OpenJdk

pwd
/opt/OpenJdk

2.download the JDK archive for Linux to your local system.
https://access.redhat.com/jbossnetwork/restricted/listSoftware.html?downloadType=distributions&product=core.service.openjdk&version=11.0.15

3.Extract the contents of the archive to a directory of your choice:

pwd
/opt/OpenJdk

tar -xf java-11-openjdk-11.0.15.0.9-3.portable.jdk.el.x86_64.tar.xz

mv java-11-openjdk-11.0.15.0.9-3.portable.jdk.el.x86_64 Jdk11

4.editor /etc/profile,Configure the JAVA_HOME environment variable:

vim /etc/profile

## 按大G健,切换最后一行,添加以下内容
export JAVA_HOME=/opt/OpenJdk/Jdk11
export PATH="$JAVA_HOME/bin:$PATH"

上面的第二行内容的目的是:
Add the bin directory of the generic JRE path to the PATH environment variable

5.生效

# 使配置文件生效
source /etc/profile

# verify
printenv | grep JAVA_HOME
java -version

评论