Comment 3 for bug 328174

useResa (rdrijsen) wrote :

I have just upgraded from Ubuntu 11.10 to Ubuntu 12.04.
One of the things I did after the upgrade is change over to Java 7 by using the PPA as described on the WEB UPD8 page (see http://www.webupd8.org/2012/01/install-oracle-java-jdk-7-in-ubuntu-via.html).

During the installation I noticed the following error message:
update-binfmts: warning: current package is oracle-java7, but binary format already installed by sun-java6

As the OP I had a very similar result when running update-binfmts --display (partial result given below)
jar (enabled):
     package = sun-java6
        type = magic
      offset = 0
       magic = PK\x03\x04
        mask =
 interpreter = /usr/lib/jvm/java-6-sun-1.6.0.26/jre/lib/jexec
    detector =

I used the suggestion as opted by the OP using the following command
$ sudo update-binfmts --package sun-java6 --remove jar /usr/lib/jvm/java-6-sun-1.6.0.26/jre/lib/jexec
update-binfmts: warning: no executable /usr/lib/jvm/java-6-sun-1.6.0.26/jre/lib/jexec found, but continuing anyway as you request

Next I reinstalled the Java 7 installer
$ sudo aptitude reinstall oracle-java7-installer

Now the warning is no longer present and the correct jexec is displayed (again partial result of upate-binfmts --display):
jar (enabled):
     package = oracle-java7
        type = magic
      offset = 0
       magic = PK\x03\x04
        mask =
 interpreter = /usr/lib/jvm/java-7-oracle/jre/lib/jexec
    detector =