Installing Java 8 on Ubuntu

 

First check if Java is already installed on the system. Run the below command to check if Java is already installed on the system.

 

java –version

 

If java is not installed on the system, you should see message similar to below.

1

 

If the java is already installed on the system, then it should display the version of java installed on the system.

 

11

 

If java is not installed on the system, then run the below command to start java installation.

sudo add-apt-repository ppa:webupd8team/java

Press [ENTER] to add the java repository information to the system.

2

3

 

Once java repository information is added, run the below command to update the package lists since java package is added to the list earlier.

 

sudo apt update

 

4

 

Run the below command to download and install java 8.

 

sudo apt install oracle-java8-installer

 

Enter ‘Y’ when the installer asks for confirmation to start java installation.

5

 

Select ‘Ok’, when the installer asks for accepting the java license.

 

6

 

Select ‘Yes’ when the  installer asks for accepting the Oracle license.

 

7

 

The download and installation of Java will take some time.

8

9

10

 

Run the below command to set the java version we have installed as the default version.

 

sudo apt install oracle-java8-set-default

 

12

Once the installation of java is complete, run the java version command again to check the java version.

 

java –version

 

11

 

 

Conclusion

 

java 8 (including JDK) is installed on Ubuntu and can be used for developing or running java applications.

One thought on “Installing Java 8 on Ubuntu

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s