How to Install JDK 8
...Less than 1 minuteProductSoftware
Download JDK 8
- Go to the following link.
Once the file is downloaded, navigate to the file location and unzip it using the following command:
unzip jdk8.zip
- Switch to superuser (it will prompt for the password):
sudo su
- Move the jdk8 folder to /usr/local/:
mv jdk8 /usr/local/
- Grant permissions to the jdk8 directory:
chmod -R 777 /usr/local/jdk8
- Set the environment variable to point to the jdk8 directory:
export JAVA_HOME=/usr/local/jdk8
- Update the repositories
sudo apt update
or alternatively:
sudo apt-get update
- Install JDK 8
sudo apt-get install openjdk-8-jdk
- To check the version
java -version
- If the correct Java version is not in use, use the alternatives command to change it:
i. Register the location where the JDK 8 directory was moved:
sudo update-alternatives --install /usr/bin/java java /usr/local/jdk8/bin/java 1
ii. Change the path:
sudo update-alternatives --set java /usr/local/jdk8/bin/java
Installation Completed!
Powered by Waline v2.15.8