Install JDK on Ubuntu
1/19/24Less than 1 minute
Two ways to install JDK on Ubuntu (Nanny-level tutorial, spoon-feeding)
I. Upload the compressed package, extract, and configure
- Download the corresponding JDK package
https://www.openlogic.com/openjdk-downloads- Extract
tar xzf openlogic-openjdk-17.0.9+9-linux-x64.tar.gz- Modify environment variables with vim
cd /etc
cp /etc/profile /home/vbox/temp/
cd /home/vbox/temp/
vim profile
# press i to edit
export JAVA_HOME=/home/vbox/java/openlogic-openjdk-17.0.9+9-linux-x64
export PATH=$PATH:$JAVA_HOME/binExecute the
source /etc/profilecommand to make the modifications take effect immediatelyTo uninstall, you only need to delete the environment variables, and you can choose to delete the extracted folder.
II. Quick Installation
- Install
# Install JRE
sudo apt-get -y install openjdk-17-jre
# Install JDK
sudo apt-get -y install openjdk-17-jdk-headless- Uninstall
apt-get purge openjdk*
apt-get purge icedtea-* openjdk-*
dpkg --list | grep -i jdk (If dpkg --list | grep -i jdk is empty, the uninstallation is complete)AI Translation | AI 翻译
This article was translated from Chinese to English by AI. If there are any inaccuracies, please refer to the original Chinese version.
本文由 AI 辅助从中文翻译为英文。如遇不准确之处,请以中文原版为准。
