Check if Java is already installed in Ubuntu
open a terminal with (Ctrl+Alt+T) and run the command :
java -version
if you seen an output like below : it means you don't have Java installed on your system.
The program ‘java’ can be found in the following packages:
* default-jre
* gcj-4.6-jre-headless
* openjdk-6-jre-headless
* gcj-4.5-jre-headless
* openjdk-7-jre-headless
Try: sudo apt-get install
* default-jre
* gcj-4.6-jre-headless
* openjdk-6-jre-headless
* gcj-4.5-jre-headless
* openjdk-7-jre-headless
Try: sudo apt-get install
if you see an output like below : it means you have Java installed on your system.
java version "1.8.0_101"
Java(TM) SE Runtime Environment (build 1.8.0_101-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.101-b13, mixed mode)
Java(TM) SE Runtime Environment (build 1.8.0_101-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.101-b13, mixed mode)
Install Java in Ubuntu
Install JRE (Java Runtime Environment) in Ubuntu
Open terminal and run the following commands.
sudo apt-get install default-jre
Install OpenJDK (Jave Development Kit) in Ubuntu
Open terminal and run the following commands.
sudo apt-get install default-jdk
Install Oracle JDK in Ubuntu
Open terminal and run the following commands of Java8 or Java7 (Couple of files need to get install so make sure that your Internet speed is high.)
Java 8 (Java 1.8)
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer
sudo apt-get install oracle-java8-set-default
OR
Java 7 (Java 1.7)
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java7-installer
sudo apt-get install oracle-java7-set-default
Now Check with the following command
java -version
You will see the output like:
java version "1.8.0_101"
Java(TM) SE Runtime Environment (build 1.8.0_101-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.101-b13, mixed mode)
Java(TM) SE Runtime Environment (build 1.8.0_101-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.101-b13, mixed mode)