JDK
下载地址:http://jdk.java.net/
wget https://download.java.net/java/ga/jdk11/openjdk-11_linux-x64_bin.tar.gz
版本使用:Open-JDK开源免费,Oracle-JDK1.8_201版本以上收费
1.上传JDK
Linux默认自带Open-JDK,所以需要先卸载自带的JDK
2.查看jdk版本
java -version
3.查看安装的JDK信息
rpm -qa | grep java
4.卸载JDK
rpm -e --nodeps java-1.6.0-openjdk-1.6.0.35-1.13.7.1.el6_6.i686
rpm -e --nodeps java-1.7.0-openjdk-1.7.0.79-2.5.5.4.el6.i686
rpm -e --nodeps java-1.8.0-openjdk-headless-1.8.0.265.b01-4.el8.x86_64
5.安装JDK
通常将软件安装到/usr/local
cd /usr/local
创建jdk文件夹
mkdir jdk
解压jdk压缩包
tar -xvf openjdk-11+28_linux-x64_bin.tar.gz -C ./jdk
#centOs解压报错处理:中文-和英文-
tar xvf openjdk-11+28_linux-x64_bin.tar.gz -C ./jdk
6.配置JDK环境
cd /etc/profile.d
vi java.sh
#set java environment
JAVA_HOME=/usr/local/jdk-11
PATH=$JAVA_HOME/bin:$PATH
export JAVA_HOME PATH
#export PATH=.:$JAVA_HOME/bin:$PATH
#set JDK Environment
#export JAVA_HOME=/usr/local/jdk/jdk-11
#export PATH=$PATH:$JAVA_HOME/bin
#export JAVA_HOME=/usr/local/jdk/jdk-11
#export PATH=$JAVA_HOME/bin:$PATH
source /etc/profile
标签:java,JDK,jdk,配置,Linux,PATH,HOME,JAVA
From: https://www.cnblogs.com/star926/p/16931590.html