Insight: How To Install Java On Ubuntu 18.04 Using APT command
Java is one of the most important software that is required for many of the software that we use in day to day life.
In this tutorial, we will show you the method to install the JRE and JDK using
apt command .
Install Java On Ubuntu 18.04
At first, Let’s check whether java has been already installed or not with the help of following command:
If not installed, you will see the message like below:
If Java is not currently installed, you’ll see the following output:
Command 'java' not found, but can be installed with: apt install default-jre apt install openjdk-11-jre-headless apt install openjdk-8-jre-headless apt install openjdk-9-jre-headless
Execute the following command to install OpenJDK:
sudo apt install default-jre
Now, Install Java Development Kit (JDK) with the help of following command. Run your terminal and execute the following command:
sudo apt install default-jdk
Now, you can verify that whether JDK is installed or not by checking the version of javac:
Use the following command to install specific version of JDK. Here we are installing OpenJDK 8:
sudo apt install openjdk-8-jdk