How to install Java on Ubuntu

Before all, let me give you some explanation about Java, JVM, JRE and JDK. If you don’t have any idea about Ubuntu, just click here to read the brief description about Ubuntu which I posted earlier. First question, What is Java? It’s a computer programming language which is very popular nowadays. Because it is fast, secure and Object Oriented Programming (OOP) Language. And also it is Platform Independent programming language. That means we can run java programs on any kind of operating system such as Windows, Ubuntu or MacOS without making no modifications to the program.

Actually that priceless feature is achieved through the JVM. JVM stands for Java Virtual Machine. JVM lets the program to run on it. That means the java programs don’t communicate directly with the OS (or the Hardware). JVM do it for the programs and it acts as a mediator between the java programs and OS. So if we change the OS, we don’t want to modify the program. Instead of that we just need to change the JVM. It’s much more easier than changing program’s code.

The next question is, What is JRE? JRE stands for Java Runtime Environment. It contains the JVM and some other files which are used by the JVM when it runs. That means if you install JRE into your computer, you can run java programs. But, if you want to develop java programs, you cannot achieve it through the JRE. You have to install JDK – Java Development KIt. It contains JRE and some other development tools that are necessary for the development process of java programs.

Okay…! Now let me take you into the today’s topic and its about How to install Oracle Java JDK8 or JDK9 on Ubuntu16.04. Actually It’s super easy..

  • First of all you have to connect your computer with internet.
  • Then open the terminal by pressing Ctrl+Alt+T
  • Then run following command
  • sudo apt-add-repository ppa:webupd8team/java
  • After adding the repository, you have to update the package list. To do that run the following command
  • sudo apt-get update
  • After that, you can install java8 by using following command.
  • sudo apt install oracle-java8-installer
  • If you want to install java 7- Sorry to say that, it will not work through this way.  The reason is oracle has removed JDK7 related binaries from their site.
  • But if you want to install JDK 9, just change the number 8 to 9.
  • sudo apt install oracle-java9-installer
  • It will takes some time to download and install the package..
  • Finally you can check the version of the java which is installed in your computer by running following command.
  • java -version
  • As I said earlier, It’s super easy…Right…?


Leave a Reply

Your email address will not be published. Required fields are marked *