I downloaded jdk-8u221-linux-x64.tar.gz
sudo mkdir /usr/local/java
cp jdk-8u221-linux-x64.tar.gz /usr/local/java
cd /usr/local/java
sudo tar xvf jdk-8u221-linux-x64.tar.gz
sudo rm jdk-8u221-linux-x64.tar.gz
sudo gedit ~/.bashrc
Add at the end after opening
export JAVA_HOME=/usr/local/java/jdk1.8.0_221
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
export PATH=${JAVA_HOME}/bin:$PATH
java -version
If something goes wrong
The program'java' has been included in the following packages:
default-jre
gcj-4.8-jre-headless
openjdk-7-jre-headless
gcj-4.6-jre-headless
openjdk-6-jre-headless
Please try: sudo apt-get install <selected package>
Terminal input
sudo update-alternatives --install /usr/bin/java java /usr/local/java/jdk1.8.0_221/bin/java 300
sudo update-alternatives --install /usr/bin/java java /usr/local/java/jdk1.8.0_221/bin/javac 300
sudo update-alternatives --config java
Enter java -version
again in the terminal to display the version installed successfully
to sum up
The above is the tutorial for installing jdk1.8 on ubuntu14.04 introduced by the editor. I hope it will be helpful to you. If you have any questions, please leave me a message, and the editor will reply to you in time. Thank you very much for your support to the ZaLou.Cn website!
If you think this article is helpful to you, welcome to reprint, please indicate the source, thank you!
Recommended Posts