openjdk-14.0.1_linux-x64_bin.tar.gz
https://injdk.cn/https://injdk.cn/
wget https://d6.injdk.cn/oraclejdk/19/jdk-19_linux-x64_bin.tar.gz
将已下载好的JDK安装包上传至服务器,可自己定义一个目录(/usr/local/java)存放并进行解压,其命令如下:
tar -zxvf jdk-19_linux-x64_bin.tar.gz
mkdir /usr/local/java
mv jdk-19 /usr/local/java
vim /etc/profile
用vim编译器来编译profile文件,在文件末尾添加如下内容:
export JAVA_HOME=/usr/local/java/jdk-19/
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib:$CLASSPATH
export JAVA_PATH=${JAVA_HOME}/bin:${JRE_HOME}/bin
export PATH=$PATH:${JAVA_PATH}
source /etc/profile
java -version
网友评论