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.

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.

share|improve this question
    
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. –  queueoverflow Oct 6 '11 at 15:58
    
Still the case with 12.04 –  Thorbjørn Ravn Andersen May 16 '12 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. –  YumYumYum Jun 5 '12 at 20:53
    
It will be better to upgrade your system to LTS. –  K.K Patel Mar 14 '13 at 9:19
    
Visit askubuntu.com/questions/64329/… –  user203206 Oct 16 '13 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.

share|improve this answer
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. –  Blair Zajac Mar 17 '12 at 20:22
    
After installing the icedtea-7-plugin ($ sudo apt-get install icedtea-7-plugin) it worked well on Ubuntu 12.04. Thanks. –  David Aug 15 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:

http://www.webupd8.org/2012/01/install-oracle-java-jdk-7-in-ubuntu-via.html

share|improve this answer

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-*

share|improve this answer
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 '11 at 22:12
    
apparently default-jre still points to Java 6. –  Thorbjørn Ravn Andersen May 16 '12 at 13:00

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

or:

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

assuming you have OpenJDK installed

share|improve this answer
1  
It seems it is not meant for 11.10. –  Ivan Oct 13 '11 at 22:13

Your Answer

 
discard

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.