Wednesday, May 9, 2012

Solving OpenJDK install errors in Ubuntu

About how to solve some errors received when installing Java / OpenJDK in different versions and releases of Ubuntu (>= 10.04.4).


When you try to install OpenJDK in Ubuntu (a required condition to install R, JGR and Deducer) you can receive some errors. They are not critical for this process, but you may want to solve them.

In Ubuntu 10.04.4, 10.10 you can receive these errors (for the 32-bit version):

> update-alternatives: error: no alternatives for mozilla-javaplugin.so
> update-java-alternatives: plugin alternative does not exist: /usr/lib/jvm/java-6-openjdk/jre/lib/i386/IcedTeaPlugin.so


or (for the 64-bit version)

> update-alternatives: error: no alternatives for mozilla-javaplugin.so
> update-java-alternatives: plugin alternative does not exist: /usr/lib/jvm/java-6-openjdk/jre/lib/amd64/IcedTeaPlugin.so


That is because you do not have installed IcedTeaPlugin, a web browser plugin based on OpenJDK and IcedTea to execute Java applets. These errors are not critical for the R, JGR and Deducer installation and running, but if you need this plugin (and to resolve these errors), just install it (but I will recommend the Adobe Flash Player plugin):
apt-get install icedtea6-plugin
and rerun:
update-java-alternatives -s java-6-openjdk

In Ubuntu 11.04 you can receive similar errors (for the 32-bit version):

> update-alternatives: error: no alternatives for mozilla-javaplugin.so
> update-java-alternatives: plugin alternative does not exist: /usr/lib/jvm/java-6-openjdk/jre/lib/i386/

or (for the 64-bit version)

> update-alternatives: error: no alternatives for mozilla-javaplugin.so
> update-java-alternatives: plugin alternative does not exist: /usr/lib/jvm/java-6-openjdk/jre/lib/amd64/

To solve the first error you just need to install the IcedTeaPlugin (see above), but the plugin will become active only if you will resolve the error number two. For this, you must edit the line at the end of '/usr/lib/jvm/.java-6-openjdk.jinfo' that looks like this (for the 32-bit version):

plugin mozilla-javaplugin.so /usr/lib/jvm/java-6-openjdk/jre/lib/i386/
or (for the 64-bit version)
plugin mozilla-javaplugin.so /usr/lib/jvm/java-6-openjdk/jre/lib/amd64/

but should look like this (for the 32-bit version):
plugin mozilla-javaplugin.so /usr/lib/jvm/java-6-openjdk/jre/lib/i386/IcedTeaPlugin.so
or (for the 64-bit version)
plugin mozilla-javaplugin.so /usr/lib/jvm/java-6-openjdk/jre/lib/amd64/IcedTeaPlugin.so

After making these changes / manipulations just run again:
update-java-alternatives -s java-6-openjdk

In Ubuntu 11.10 you can receive another interesting error:
> update-alternatives: error: no alternatives for -javaplugin.so
because of this bug.

In Ubuntu 11.10 the openjdk-6-jdk package creates a file '/usr/lib/jvm/.java-1.6.0-openjdk.jinfo' for both 32/64-bit versions, while openjdk-7-jdk package creates two files - '/usr/lib/jvm/.java-1.7.0-openjdk-i386.jinfo' for the 32-bit and '/usr/lib/jvm/.java-1.7.0-openjdk-amd64.jinfo' for the 64-bit versions. A line at the end of these files defines the alternative for the Firefox java plugin. This line must begin with "plugin mozilla-javaplugin.so". Check it, and if you found that this line begins with "plugin -javaplugin.so" correct this by adding "mozilla" to "-javaplugin.so".

nano /usr/lib/jvm/.java-1.6.0-openjdk.jinfo

nano /usr/lib/jvm/.java-1.7.0-openjdk-i386.jinfo

nano /usr/lib/jvm/.java-1.7.0-openjdk-amd64.jinfo

I do not know why this happens, but if you have installed the openjdk-7-jdk package you also must correct the 'jinfo' file created by openjdk-6-jdk, even if this package was not installed, otherwise the error do not disapear.

Note:
An icedtea-plugin package for OpenJDK 7 in Ubuntu 11.10 does not exists. To solve fully this problem you can install (see above) and indicate as alternative the IcedTeaPlugin for the OpenJDK 6. Just edit the 'jinfo' file created by openjdk-7-jdk package and change the line beginning with "plugin mozilla-javaplugin.so" to (for the 32-bit version):

plugin mozilla-javaplugin.so /usr/lib/jvm/java-6-openjdk/jre/lib/i386/IcedTeaPlugin.so
or (for the 64-bit version)
plugin mozilla-javaplugin.so /usr/lib/jvm/java-6-openjdk/jre/lib/amd64/IcedTeaPlugin.so

After making these changes / manipulations just run again:
update-java-alternatives -s java-1.7.0-openjdk-i386
or
update-java-alternatives -s java-1.7.0-openjdk-amd64

For Ubuntu 12.04 run in terminal:
sudo apt-get install -y icedtea-7-plugin
and rerun (for 32-bit version):
update-java-alternatives -s java-1.7.0-openjdk-i386
OR (for 64-bit version)
update-java-alternatives -s java-1.7.0-openjdk-amd64

0 comments:

Post a Comment