In able to install JDK in Ubuntu, follow these steps:
1. Open terminal.
2. Update the repository using these commands:
sudo add-apt-repository ppa:openjdk-r/ppa # only Ubuntu 17.4 and earlier
sudo apt update
3. After that, install the version which you want, using these commands:
sudo apt install openjdk-8-jdk
sudo apt install openjdk-8-source #this is optional, the jdk source code
4. In able to set JAVA_HOME, use this command with your installation path:
5. For setting up path, try the below command:
6. Once done, you can check the version:
I hope this will help.
Want to become a Java expert? join Java Certification now!!
Want to know more about Java? Watch this video on Java Tutorial For Beginners: