Install Latest Java on Ubuntu

Install Latest Java on Ubuntu

Install latest Java on Ubuntu 16.04

Java -:

Java software for your computer, or the Java Runtime Environment, is also referred to as the Java Runtime, Runtime Environment, Runtime, JRE, Java Virtual Machine, Virtual Machine, Java VM, JVM, VM, Java plug-in, Java plugin, Java add-on or Java download.

Install Default Java JRE/JDK

$ sudo apt-get update
$ apt-get install default-jre default-jdk

Install Oracle Java JDK.

Add the below repository-:

$ sudo add-apt-repository ppa:webupd8team/java
$ sudo apt-get update

Install Oracle JDK 6

$ sudo apt-get install oracle-java6-installer

Install Oracle JDK 7

$ apt-get install oracle-java7-installer

Install Oracle JDK 8

$ sudo apt-get install oracle-java8-installer

Install Oracle JDK 9

$ sudo apt-get install oracle-java9-installer

Manage different versions of Java.

There can be multiple Java installations on one server. You can configure which version is the default for use in the command line by using update-alternatives, which manages which symbolic links are used for different commands.

$ sudo update-alternatives --config java

Choose the version you wants to select.

Setting the JAVA_HOME Environment Variable.

Use the below command to get the current java path.

$ update-alternatives --config java
update-alternatives --config java
There is only one alternative in link group java (providing /usr/bin/java): /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java
Nothing to configure.

Open the environment file.

$ sudo nano /etc/environment

paste the path like below-:


Save and exit the file.

source /etc/environment


$ echo $JAVA_HOME
Gotechnies Sysadmin Blog

Rating: 4.9
Votes: 375
Reviews: 330

Post a comment