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.
Best Answer
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.