download
wget https://download.oracle.com/java/20/latest/jdk-21_linux-x64_bin.deb
jdk下载登录/oracle账号
# 好心人的帐号
账号: 59968873@qq.com
密码: ZxC32145
账号: jkma404@gmail.com
密码: ZxC12345
配置
sudo dpkg -i jdk-21_linux-x64_bin.deb
rpm -ivh jdk-21_linux-x64_bin.rpm
vim /etc/profile
export JAVA_HOME=/usr/java/jdk-201_linux-x64_bin.rpm
export CLASSPATH=$CLASSPATH:$JAVA_HOME/lib:$JAVA_HOME/jre/lib
export PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH:$HOME/bin
source /etc/profile
jdk多个版本使用别名管理
sudo update-alternatives --list java
sudo update-alternatives --config java
sudo update-alternatives --install /usr/bin/java java /path/to/jdk1.8.0/bin/java 1
sudo update-alternatives --install /usr/bin/java java /path/to/jdk21/bin/java 2
sudo update-alternatives --config java
alternatives --display java
alternatives --config java
alternatives --install /usr/bin/java java /path/to/jdk1.8.0/bin/java 1
alternatives --install /usr/bin/java java /path/to/jdk21/bin/java 2
alternatives --config java
export JAVA_8_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_271.jdk/Contents/Home
export JAVA_20_HOME=/Library/Java/JavaVirtualMachines/jdk-20.jdk/Contents/Home
alias jdk8="export JAVA_HOME=$JAVA_8_HOME"
alias jdk20="export JAVA_HOME=$JAVA_20_HOME"