Table of contents
3. Verify that the JDK installation is successful
Foreword to Avoid the Pit: Since Oracle has changed the version agreement of jdk8, we cannot use the ppa source to install it
In other words, the online ppa source tutorials are all invalid (if you don’t believe me, look at the time, most of them were before April 19)
It took a long time to find out
Oracle Java (JDK) 8 Installer PPA (DISCONTINUED) : “WebUpd8” team
This article demonstrates under Ubuntu, Debian operation is the same, Redhat and centos are the same
Since Oracle's jdk cannot be installed directly with the package manager, we use open jdk , which is similar
1. Update the software source
sudo apt update
2. Install openjdk-8-jdk
sudo apt install openjdk-8-jdk
3. Verify that the JDK installation is successful
java -version
4. Configure JAVA_HOME
sudo gedit /etc/profile
Add these things at the end of the file (the jdk installation directory is changed according to your own)
export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-amd64 #jdk安装目录
export JRE_HOME=$JAVA_HOME/jre
export CLASSPATH=$JAVA_HOME/lib:$JRE_HOME/lib:$CLASSPATH
export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH
Ctrl+s to save and exit
Make the configuration file take effect
sudo source /etc/profile
5. Verify JAVA_HOME
echo $JAVA_HOME