Administrator
发布于 2023-06-08 / 52 阅读
0
0

OpenJdk Install Doc

OpenJdk 有很多发行版,我们这里选择的是RedHat发行的OpenJdk

下载地址

https://developers.redhat.com/products/openjdk/download

安装步骤

refer to : https://access.redhat.com/documentation/en-us/openjdk/8/html/installing_and_using_openjdk_8_for_rhel/assembly_installing-openjdk-8-on-red-hat-enterprise-linux_openjdk#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://developers.redhat.com/products/openjdk/download

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

pwd
/opt/OpenJdk

tar -xf java-1.8.0-openjdk-portable-1.8.0.322.b06-4.portable.jdk.el7.x86_64.tar.xz
mv  java-1.8.0-openjdk-portable-1.8.0.322.b06-4.portable.jdk.el7.x86_64  Jdk8

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

vim /etc/profile

## 按大G健,切换最后一行,添加以下内容
export JAVA_HOME=/opt/OpenJdk/jdk8
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

评论