How to upgrade Java on Ubuntu?
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.
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-installerif you want java8 :
sudo apt-get install oracle-java8-installerIf 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
11Note: 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
Found something useful here..
Installing Java with apt-get is easy. First, update the package index:
sudo apt-get updateCheck if Java is not already installed:
java -versionThen install java jre/jdk :
sudo apt-get install default-jre sudo apt-get install default-jdkFor details please go to :
1Updated for Ubuntu 18.04
Use ppa :
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installerFor 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-installerOn 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-installerFor more infos see:
if you want Java 11:
sudo apt install openjdk-11-jre-headless
sudo apt install openjdk-11-jdkIf 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
- (by @Nymeria)
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).
1More in general
"Zoraya ter Beek, age 29, just died by assisted suicide in the Netherlands. She was physically healthy, but psychologically depressed. It's an abomination that an entire society would actively facilitate, even encourage, someone ending their own life because they had no hope. Th…"