Surprisingly (as OpenJDK 7 was released to general availability about 4 months ago) Ubuntu 11.10 still uses OpenJDK 6 instead of 7 by default. How do I best fix this? I'd prefer to remove OpenJDK 6 completely and let OpenJDK 7 to be the default-jdk and default-jre.

I don't want the official Oracle tarballs, I want deb repos - the standard Ubuntu way.

  • Somebody would have to build that into a Debian package and put it into a PPA on Launchpad. If nobody did that yet, you can either make a .deb or install the tar. Oct 6, 2011 at 15:58
  • Still the case with 12.04 May 16, 2012 at 12:59
  • Year 2011 - Now Year 2012 - was this resolved really (which one was considered to be the answer lol? If not i gonna write a nice wiki on this in my question / answer.
    – user25165
    Jun 5, 2012 at 20:53
  • It will be better to upgrade your system to LTS.
    – KK Patel
    Mar 14, 2013 at 9:19
  • Visit askubuntu.com/questions/64329/…
    – user203206
    Oct 16, 2013 at 9:32

4 Answers 4


The problem is that the default-jre package depends on OpenJDK 6 and most other packages have their dependencies defined as default-jre | openjdk-6-jre | sun-java6-jre - so until OpenJDK 7 becomes officially supported and will be used as the default version, or until all Java-dependent packages update their dependencies, you'll have to keep OpenJDK 6 around and set the OpenJDK 7 as default using update-java-alternatives. Example for 64-bit system:

$ update-java-alternatives -l
java-1.6.0-openjdk 1061 /usr/lib/jvm/java-1.6.0-openjdk
java-1.7.0-openjdk-amd64 1051 /usr/lib/jvm/java-1.7.0-openjdk-amd64
$ sudo update-java-alternatives -s java-1.7.0-openjdk-amd64

On 32-bit system the directory name will differ, you can find the right name using the -l switch. The second command may spit a lot of errors; either use --jre switch or just ignore errors – the script changes what it can and just ignores the rest.

One could theoretically edit the default-jre package to depend on OpenJDK 7, but be warned that this can cause more harm than good.

  • 2
    To get this to work on precise I had to ensure that for each openjdk-6 or icedtea-6 package there was a corresponding openjdk-7 or icetea-7 package, otherwise update-java-alternatives will fail to make the switch. Mar 17, 2012 at 20:22
  • 2
    After installing the icedtea-7-plugin ($ sudo apt-get install icedtea-7-plugin) it worked well on Ubuntu 12.04. Thanks.
    – David
    Aug 15, 2014 at 16:48

For this, you must have both versions of jdk installed on your system. you can use apt-get to download both.

After that try,

$ sudo update-alternatives --config java

and select the jdk you want to use.

Openjdk is sometimes unfavourable, for some of the applications.

You should also try for oracle-java or sun-java.

The link below is very useful for this purpose:



OpenJDK 7 is in the normal ubuntu repos in 11.10, if you look for openjdk-7-jre and openjdk-7-jdk and install them using apt-get/synaptic/software centre they should replace openjdk-6, if it doesn't you could remove the openjdk-6-* packages first using apt-get purge openjdk-6-*

  • 1
    openjdk-7-* packages seem to be meant to be installed side-by-side with openjdk-6-. And if I try to remove openjdk-6-, there are tons of packages to be removed as dependant (despite the fact I know some of those applications work perfectly with Java 7).
    – Ivan
    Oct 13, 2011 at 22:12
  • apparently default-jre still points to Java 6. May 16, 2012 at 13:00

The repo can be found here: https://launchpad.net/~openjdk/+archive/ppa


sudo apt-add-repository ppa:openjdk/ppa
sudo apt-get update
sudo apt-get upgrade

assuming you have OpenJDK installed

  • 1
    It seems it is not meant for 11.10.
    – Ivan
    Oct 13, 2011 at 22:13

Your Answer

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

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