M BUZZ CRAZE NEWS
// general

How to upgrade Java on Ubuntu?

By Emma Johnson

I installed Ubuntu on my computer, and now my Java version is not updated. I have Java, so I don't need to install - just update the current version.

Can someone please tell me the command I have to use to get the current version?

I have tried: apt-get update and apt-get upgrade.

1

6 Answers

Note: WebUpd8 team's PPA has been discontinued with effective from April 16, 2019. Thus this PPA doesn't have any Java files. More information can be found on PPA's page on Launchpad. Hence this method no longer works and exists because of historical reasons.

Use ppa :

sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java7-installer

if you want java8 :

sudo apt-get install oracle-java8-installer

If you ABSOLUTELY need to have the latest update of java you must manualy install from official source, follow this tuto :

But I advise you to wait as ppa update

11

Note: WebUpd8 team's PPA has been discontinued with effective from April 16, 2019. Thus this PPA doesn't have any Java files. More information can be found on PPA's page on Launchpad. Hence this method no longer works and exists because of historical reasons.

The newest OpenJDK Java packaged for trusty (14.04) right now is 7u55. You can check your Java version with java -version from the command line in Terminal.

If you want a newer one your best options will be to:

  • wait for an update from Ubuntu, OR

  • install the Oracle distribution of Java which currently is at 7u65:

    sudo add-apt-repository ppa:webupd8team/java
    sudo apt-get update
    sudo apt-get install oracle-java7-installer
4

Found something useful here..

Installing Java with apt-get is easy. First, update the package index:

 sudo apt-get update

Check if Java is not already installed:

 java -version

Then install java jre/jdk :

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

For details please go to :

1

Updated for Ubuntu 18.04

Use ppa :

sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer

For more infos see:

if you want java9: (Now some Programs like JabRef still need Java8)

sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java9-installer

On you can see a detailed explanation how to install Java9, and how to change it to default.

if you want Java 10:

sudo add-apt-repository ppa:linuxuprising/java
sudo apt update
sudo apt install oracle-java10-installer

For more infos see:

if you want Java 11:

sudo apt install openjdk-11-jre-headless
sudo apt install openjdk-11-jdk

If you need the latest update you can download it from

  • Java 8:
  • Java 9:
  • Java10:

If you have problems to install the latest updates see:

This question uses content from

5

Don't know why everyone has answered with oracle, but here is open jdk:

sudo apt-get install openjdk-7-jre

Another possible solution is to add the PPA repository from the project ubuntu-justched available in the Github. This will provide a little bit different solution because it will download the Oracle JRE tarball to a previously configured directory and generate a DEB package from it.

That way you won't depend on somebody else packing the JRE, you will do it yourself (don't worry, it will be an automatic process).

1

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy