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.
The problem is that the
default-jre
package depends on OpenJDK 6 and most other packages have their dependencies defined asdefault-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 usingupdate-java-alternatives
. Example for 64-bit system: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.For this, you must have both versions of jdk installed on your system. you can use apt-get to download both.
After that try,
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
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-*
The repo can be found here: https://launchpad.net/~openjdk/+archive/ppa
or:
assuming you have OpenJDK installed