Tommy Stanton

Computer programmer and banjo picker

Getting Java to work again in Iceweasel

I am still running Debian Lenny on my little Asus 1000HD netbook (I really need to upgrade since I'm now on oldstable).

The Debian Project prefers distributing Iceweasel over Firefox in its software repositories.

One day my Java plugin was no longer working in Iceweasel, so I investigated.

Use Sun Java

First, I made sure that Sun's Java was my default (I guess it was changed at some point):

$ sudo update-alternatives --config java

There are 3 alternatives which provide 'java'.

  Selection    Alternative
-----------------------------------------------
          1    /usr/bin/gij-4.3
 +        2    /usr/lib/jvm/java-gcj/jre/bin/java
*         3    /usr/lib/jvm/java-6-sun/jre/bin/java

Press enter to keep the default[*], or type selection number: 3

Set the Iceweasel plugin

Alright, now to check the web browser plugins. First, let's look at the system-wide plugins:

$ cd /usr/lib/mozilla/plugins/
$ file libjavaplugin.so
libjavaplugin.so: symbolic link to
'/etc/alternatives/mozilla-javaplugin.so'
$ file /etc/alternatives/mozilla-javaplugin.so
/etc/alternatives/mozilla-javaplugin.so: symbolic link to
'/usr/lib/jvm/java-6-sun/jre/lib/i386/libnpjp2.so'

That looks good, it's pointing to Sun.

Maybe there's something funky in my user-specific plugin settings:

$ cd ~/.mozilla/plugins/
$ file libjavaplugin_oji.so
libjavaplugin_oji.so: symbolic link to
'/usr/lib/jvm/java-6-sun/jre/plugin/i386/ns7/libjavaplugin_oji.so'

Yup libnpjp2.so is what I want, and that's set up system-wide. libjavaplugin_oji.so is not correct. Let's "delete" it and see if that fixes the browser:

$ mv libjavaplugin_oji.so /tmp/ # Temporarily get rid of this plugin

...and now Iceweasel's Java plugin magically works again. I'll just let that libjavaplugin_oji.so symlink sit in /tmp/ until I shut down my laptop and it is automatically deleted. >=D

Post-investigation

I believe that the culprit, the libjavaplugin_oji.so symlink in ~/.mozilla/plugins/, was created by dpkg when I upgraded Sun's Java sometime in the last month.

$ sudo zgrep sun\-java /var/log/dpkg* | grep install | grep -v half \
| less -S
/var/log/dpkg.log:2011-10-04 02:07:05 install sun-java6-plugin <none> 6-26-0lenny1
/var/log/dpkg.log:2011-10-04 02:07:08 status installed sun-java6-plugin 6-26-0lenny1
/var/log/dpkg.log.1:2011-10-01 21:19:52 status installed sun-java6-bin 6-26-0lenny1
/var/log/dpkg.log.1:2011-10-01 21:19:59 status installed sun-java6-jdk 6-26-0lenny1
/var/log/dpkg.log.1:2011-10-01 21:20:00 status installed sun-java6-jre 6-26-0lenny1
/var/log/dpkg.log.11.gz:2010-12-05 19:51:07 status installed sun-java6-bin 6-22-0lenny1
/var/log/dpkg.log.11.gz:2010-12-05 19:51:15 status installed sun-java6-jdk 6-22-0lenny1
/var/log/dpkg.log.11.gz:2010-12-05 19:51:16 status installed sun-java6-jre 6-22-0lenny1
blog comments powered by Disqus