Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Recently, I've installed JDK 7 from the Oracle site, using these instructions.

Now, I'm wondering what is the correct method to update it (or, better, to keep up-to-date automatically)? For instance, there were some security issues fixed few days ago.

share|improve this question
@PawełPrażak err... Install != update ;) –  Braiam Jan 25 '14 at 0:53
@Briam works for update –  Paweł Prażak Jan 25 '14 at 15:32
@PawełPrażak "Now, I'm wondering what is the correct method to update it (or, better, to keep up-to-date automatically)?" –  BuZZ-dEE Feb 13 '14 at 20:32

1 Answer 1

up vote 67 down vote accepted

You can use the webupd8 java ppa, so you get updates automatically through the package manager.

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

If you need the latest Oracle Java 6, you install it too:

sudo apt-get install oracle-java6-installer

If you want test Oracle Java 8 early access builds, you can install it too:

sudo apt-get install oracle-java8-installer

To switch between different Java versions, you could use the following terminal command:

sudo update-alternatives --config java


share|improve this answer
I can't downvote rightnow but I criticize this. You told an entirely new way of installation instead of answering upon what OP asked for. May be didn't choose webupd8 installation because of some valid reasons. Like in my case I didn't go for it as it didn't provided just JRE & I didn't required the entire JDK package. I think you must provide an answer to the OP's situation besides suggesting this alternate way. –  user01 Sep 29 '13 at 4:48
Reread the OP, user01: "Recently, I've installed JDK 7 from the Oracle site," The question is therefore: "How can I keep my JDK installations up to date automatically?" –  avgvstvs Oct 19 '13 at 18:46
This is very good answer, indeed. If there were another one, explaining how to do it without repositories, I'd probably upvoted it too. –  pilat Apr 17 '14 at 6:59
Is there a way to run update-alternatives when you don't have interactive access? Like during ansible provisioning? –  user276355 Apr 30 '14 at 16:05

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.