下载安装包
cd /usr/local/jdk wget https://download.oracle.com/java/17/latest/jdk-17_linux-x64_bin.tar.gz -P /usr/local/jdk/ 或 wget http://49.232.8.65/jdk/jdk17/jdk-17_linux-x64_bin.tar.gz -P /usr/local/jdk/
解压
tar xf /usr/local/jdk-17_linux-x64_bin.tar.gz -C /usr/local/jdk/
配置环境变量
vim /etc/profile #末尾添加如下位置 export JAVA_HOME=/home/jdk17/jdk-17.0.1 export CLASSPATH=.:$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/dt.jar export PATH=$JAVA_HOME/bin:$PATH
或
#JAVA export JAVA_HOME=/usr/local/jdk/jdk-17.0.1 export JRE_HOME=${JAVA_HOME}/jre export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib export PATH=.:${JAVA_HOME}/bin:$PATH
重新加载配置文件
source /etc/profile
验证
java javac java -version
标签:JAVA,jdk,jdk17,local,export,usr,linux,HOME,安装 From: https://www.cnblogs.com/cgy-home/p/17999375