Ruarí's thoughts

Thristy for some IcedTea? Perhaps you should try a hot cup of (Oracle) Java instead!

, , , , , , ,

Shortly after my last blog post I realised that I couldn't get the IcedTea plugin working on my 64bit Ubuntu 10.04 installation. Then a little latter enzolatina commented that he couldn't get it working either on 64bit Arch. After I made sure a bug was logged, I replied to him and confirmed that I could see what he meant.

Two things bothered and confused me though. Whilst we admittedly had focussed our attention on getting the Sun/Oracle Java plugin working first and foremost (since they are the primary Java authors and hence provide the point of reference), I was fairly sure we had done some testing with OpenJDK/IcedTea. In fact I even had the vaguest recollection of having tested it myself! yikes Odder still the failure I received on 64bit Ubuntu was not the same as the error that enzolatina received! On my system the plugin wasn't even detected by Opera sad so it couldn't even get to the stage of crashing.

Having now investigated this a little further I realise things are a lot more messy than they initially appeared. In fact I would now go so far as to suggest (Ubuntu) users drop IcedTea as their Java browser plugin of choice (for now at least) and I am beginning to wonder if we should put the effort in to get it working before Opera *nix hits its first Evenes final! This is despite the fact that IcedTea is the default Java plugin on Ubuntu 10.04 and the Oracle/Sun Plugin is only available after a user manually adds the partner repository or downloads directly from the Java website. Hence many new Ubuntu users would never even think to install anything other than IcedTea.

Does this seem a little harsh. Ok, let me explain. wink

Going back to my own investigation, my next step was to try IcedTea on my Arch 64bit install to see if I could replicate the plugin crash that enzolatina had seen. So I removed Sun/Oracle Java plugin and installed IcedTea, fired up Opera and loaded the Java test page. To my surprise it loaded and displayed correctly! I did see a little output in the terminal but nothing to cause major concern.

What put me on the right course to getting my head around this, was a comment provided by my friend Remco (Lanting). Since the IcedTea plugin was not detected on my Ubuntu install he suggested something I have often told users who find themselves with none working plugins, run 'ldd' against it. And guess what, its dependencies were not satisfied. You might wonder how Firefox is then able to run the IcedTea plugin but it immediately stuck me that this was very similar to one of the Flash problems that users often bump into. The required libs are found within Firefox's own libs directory rather than the system libs directory. Indeed it would seem that the IcedTea plugin needs Firefox/xulrunner libs to actually run. It is effectively dependant on Mozilla components being installed even though the packaging dependencies on Ubuntu don't mention this.

Don't believe me? Well if you are an Ubuntu 10.04 user install IcedTea and after confirming that it doesn't work with Opera and try the following:

sudo ln -s /usr/lib/firefox-3.6.3/libxpcom.so /usr/lib/libxpcom.so
sudo ln -s /usr/lib/firefox-3.6.3/libmozjs.so /usr/lib/libmozjs.so
sudo ln -s /usr/lib/firefox-3.6.3/libxul.so /usr/lib/libxul.so
sudo ln -s /usr/lib/libsqlite3.so.0 /usr/lib/libsqlite3.so
(note: In the last symlink, the eagle eyed might note that I am not linking to a lib within the Firefox directory but rather one on the system. I could link to the Firefox version of libsqlite3.so [it does bundle it] but I don't need to since the libsqlite package is installed. However IcedTea expects the file name to be named exactly libsqlite3.so or it will fail. Another IcedTea problem or a packaging issue for libsqlite? You decide, either way you have to work around it.)

Now load the Java test page. Does it work for you? I suspect it will. wink

Right, now it starts to get interesting! Some of you might be thinking that if IcedTea needs Firefox to be installed and even when it is installed it won't work in Opera because the libs are in the wrong place, wouldn't this also break other browsers? Yes it would and a Google search will quickly lead you to disgruntled users of other browsers such this Chrome user (whose blog post handily tells you how to install Oracle/Sun Java via the Lucid partner repositories). And it is not just Opera and Chrome, you can find complaints from users of other *nix browsers as well. Indeed you soon stumble across this Ubuntu bug report from a Chrome/Midori user. So yes, on Ubuntu at least, IcedTea only works in Firefox. Not due to some failing on the part of Chrome, Midori or Opera devs but rather due to Ubuntu packaging issues with the IcedTea plugin itself. faint

Before I go on, what about enzolatina's plugin crash? No, I hadn't forgotten. wink Having now tested IcedTea a little further I find I can replicate the same problem as him. On some more complex Java pages the plugin wrapper does indeed crash when IcedTea is used. What I don't yet know (since I have not yet got any of our plugins devs involved, nor extensively cross tested with Firefox) is if these crashes are due to some limitation in our plugin implementation or a failing of on the part of OpenJDK itself. None the less I'll sum up my thoughts thus far.

It would seem that on some distros IceaTea will work (albeit not consistently), on others it may fail due to packaging problems, in all cases it appears to depend on Mozilla libs.

So what would we need to do to get Java working for your average (Ubuntu) user before Opera *nix reaches a final. Well, assuming no fixes upstream either from distros or OpenJDK (within the required timescale ) it might still be possible to get the IcedTea plugin working in a similar manor to how it functions in Firefox but it would require some fairly ugly hacks. For example we would need to check on startup if IcedTea was installed, if so that the libs are satisfied, if not check if Firefox is installed, if it is installed check where it is installed, (assuming yes) if it includes the libs to get IcedTea working and (assuming yes again) preload them! Such hacks could have negative effects by introducing other bugs and will still fail in some cases. Consider that a user might uninstall Firefox but leave the IcedTea plugin installed. In which case it still won't work as the libs won't be available but the average user would have no way of knowing this was not an Opera issue. An even bigger problem is that developing such a hack is not free. We'd have to take development resources away from other bugs. Indeed on the testing side I have already spent most of a day looking at this when I would have preferred sign off on a number of nice fixes that we have lined up for *nix users (including more font work). So this issue has already introduced some delay in our preparations for the final. sad

In summary, we haven't yet decided what we'll do about this issue but I hope you now better understand the statement I made in the third paragraph of this blog post. To restate, personally I'd suggest users who want Java support to use the Oracle/Sun solution (for now at least).

Java still not working?Problems inputting text? Help us, help you!

Comments

Patkos Csabapatkoscsaba Saturday, June 19, 2010 11:52:20 AM

Here is one for you ... Mandriva 2010.1 64bits (Compiz +xfce), both icedTea and SunJava installed.
Opera detects ONLY the IcedTea plugin in Preferencies. However the Java test page works. ( http://www.java.com/en/download/help/testvm.xml )

Any thoughts on this one?

LE: ah .... and btw, the test says
Your Java configuration is as follows:
Vendor: Sun Microsystems Inc.
Version: Java 6 Update 18
Operating System: Linux 2.6.33.5-desktop-1mnb
Architecture: amd64

JeroenDuologic Saturday, June 19, 2010 7:25:11 PM

Well, IcedTea (openjdk6 package) is indeed working in Opera (build 6368 and 6374) on Arch64

I hardly use java (just installed it for this), but I thought I should test and report it here after reading the post.

Ruarí Ødegaardruario Saturday, June 19, 2010 9:30:44 PM

Originally posted by patkoscsaba:

Opera detects ONLY the IcedTea plugin in Preferencies.

What results do you get from:
find / -name libnpjp2.so -print 2>/dev/null
I expect you will find it somewhere like:
/usr/lib/jvm/java-1.6.0-sun-1.6.0.20/jre/lib/amd64/libnpjp2.so
You can setup a symlink in your plugins directory by issuing the following as root:
ln -s /usr/lib/jvm/java-1.6.0-sun-1.6.0.20/jre/lib/amd64/libnpjp2.so /usr/lib/opera/plugins/libnpjp2.so
Once done, it should be detected.

P.S. IcedTea works for you because its dependencies are clearly setup correctly on Mandriva.

Originally posted by Duologic:

Well, IcedTea (openjdk6 package) is indeed working in Opera (build 6368 and 6374) on Arch64

Indeed on Arch it is detected (as enzolatina and I found) because it is packaged correctly. It might still be more prone to crashing however. In my limited tests that seemed to be the case.

Patkos Csabapatkoscsaba Sunday, June 20, 2010 11:58:47 AM

Originally posted by ruario:

You can setup a symlink in your plugins directory by issuing the following as root:

ln -s /usr/lib/jvm/java-1.6.0-sun-1.6.0.20/jre/lib/amd64/libnpjp2.so /usr/lib/opera/plugins/libnpjp2.so
Once done, it should be detected.


Wouldn't that mess with the settings if I will have an update to the java plugin? If there will be a 1.6.1 java (or something different in a different folder) my symlink will become useless. I am trying to avoid doing symlinks and other artifacts like this because it is hard to track them. If I will have a java update after 6 months I most certainly will forget about what I did to make it work.
So, even if the "find" command you gave returned what you were expecting, I am reluctant to symlink to it, because later I will have to always fix the link. Opera or Mandriva should make the symlink, not me.

Ruarí Ødegaardruario Sunday, June 20, 2010 8:06:17 PM

Originally posted by patkoscsaba:

Wouldn't that mess with the settings if I will have an update to the java plugin?

Yes, you would have to redo it.

Originally posted by patkoscsaba:

Opera or Mandriva should make the symlink, not me.

I completely agree, Mandriva should make the symlink and if they don't you should log it as a packaging bug with them. Arguably they should put it in /usr/lib/mozilla/plugins rather than /usr/lib/opera/plugins since FF is their default browser but either way it is a job for them to do, not us. (It would not actually matter to Opera if they place the symlink in /usr/lib/mozilla/plugins since we look in this directory for browser plugins anyway).

The reason they should do it is that we (like you) also don't know where the plugin might be located. The best we can do is look in the standard browser plugin directories. Even the name of the actual plugin file could change. Only a distro can keep track of where the plugin currently is and make sure it symlinks into a browser plugin directory, since they are the one maintaining the packaging of Java. Hence they are the only people who can properly fix this. Also they can fix it once for all browsers by placing it in a standard directory. If the browsers each have to hunt down different plugins in different directories with variation across distros it will get very messy very fast and each browser has to refix the problem after every update of every plugin.

The fact that some distros aren't doing this is the reason I wrote this blog post (to help users work around poor packaging of plugins). If you want this fixed for the future I would encourage you to log a bug with them.

In the mean time if you want working Java and find issues with OpenJDK/IcedTea you will unfortunately have to symlink it yourself. I sympathise but outside of highlighting the issue I (and Opera) can't really help you any more than that. sad

Patkos Csabapatkoscsaba Sunday, June 20, 2010 9:08:34 PM

LE: Mandriva users should read the bugreport below. It explains how different plugins installed at the same time works, and how to change to the one you want.
----------------------------------------------------------------

Done https://qa.mandriva.com/show_bug.cgi?id=59858

Ruarí Ødegaardruario Monday, June 21, 2010 4:29:54 AM

Thanks patkoscsaba! That bug report has certainly helped clarified the situation On Mandriva for me. So from an educational viewpoint was certainly worth it (at least from my perspective p).

I was aware of Debian based distros having an 'alternatives' system since that is the reason for the 'flashplugin-alternative.so' symlink pointing to another symlink and then the actual flash plugin in this blog post. However, I hadn't realised that Mandriva has a similar setup, despite Mandriva being my last 'primary' distro before I switched to Arch.

Ok, in that case I take it all back. It seems it is not a bug with Mandriva, since most users would only ever install one plugin.

P.S. I agree that switching to the last installed plugin is more likely what the user wants, otherwise why did they install the second plugin? However, it is worth noting that on Debian based distros the symlink is not updated either (last time I checked). I saw a user confused by this who had installed Gnash followed by Adobe Flash and found that he was still using Gnash. To his mind, why wouldn't it default to Flash (he only installed it after he found that Gnash didn't work well for him)?

Cutting Spoonhellspork Monday, June 21, 2010 4:51:42 AM

Hmmm....would violence make them move any faster?

I guess the worst of this is how much time guys like you need to spend dealing with other peoples' mistakes.

Patkos Csabapatkoscsaba Monday, June 21, 2010 11:07:59 AM

Originally posted by ruario:

Ok, in that case I take it all back. It seems it is not a bug with Mandriva, since most users would only ever install one plugin.


I'ts not a bug at all, nor with Mandriva or with Opera ... After I simply uninstalled the IcedTea (openjdk) plugin, the link in /etc/alternatives auto-magically changed to SUN's Java plugin, so everything is OK now with Opera. It detects the right plugin and it uses it the right way... The only think I did not know was how links in "alternatives" are created or how to change them. That bug report clarified the situations for me, too.

Ruarí Ødegaardruario Monday, June 21, 2010 11:12:59 AM

Originally posted by patkoscsaba:

The only think I did not know was how links in "alternatives" are created or how to change them.

look at the rpm scripts (rpm -q --scripts [package name]) for the Java plugins. I haven't personally checked but I wouldn't be surprised if some of the 'magic' was done there.

arghwashier Monday, June 21, 2010 7:30:25 PM

Originally posted by patkoscsaba:

I'ts not a bug at all, nor with Mandriva or with Opera ... After I simply uninstalled the IcedTea (openjdk) plugin, the link in /etc/alternatives auto-magically changed to SUN's Java plugin, so everything is OK now with Opera. It detects the right plugin and it uses it the right way... The only think I did not know was how links in "alternatives" are created or how to change them. That bug report clarified the situations for me, too.


With the update-alternatives command. I am not sure of the exact syntax but I did manage to set a different gcc version once so it shouldn't be to difficult

Ruarí Ødegaardruario Monday, June 21, 2010 8:01:34 PM

I think he now knows how to switch it, since Mandriva kindly told him wink

update-alternatives --config libjavaplugin.so.x86_64

P.S. My own comment was really about how it might work behind the curtain. He may have worked that out already but I thought it might be interesting to other readers as well.

arghwashier Monday, June 21, 2010 8:10:11 PM

Originally posted by ruario:

P.S. My own comment was really about how it might work behind the curtain. He may have worked that out already but I thought it might be interesting to other readers as well.




I think with Provides in the spec file what else is involded I don't know maybe some post install scripts are required too. Mandriva has a very elaborate and clever rpm script system so it might even happen automatically when an rpm has a provides...

edit: answer here: http://wiki.mandriva.com/en/Development/Howto/Alternatives

Ken Rushiakrushia Wednesday, June 23, 2010 9:36:23 PM

Thanks for revealing this Ruari. My sympathies to you and Opera users who run into these puzzles. I hope the Linux community can see the lesson here, and work towards making a little more sense in the future.

Cutting Spoonhellspork Wednesday, June 23, 2010 10:27:05 PM

Doesn't seem these people can even agree on basic things. Different settings locations, different filenames etc, lots of relying on symlinks to make everything better.

Symlinks were a comforting lie.

Symlinks do not make everything better.

mfbd Saturday, June 26, 2010 9:48:40 AM

thank you for the hints to get the sun-java-plugin running fine with opera 10.60 (64) on opensuse 11.2 (64) kde 4.4.4!
my java testpage on http://www.heise.de/security/dienste/Java-403125.html is working.
just only a symlink to libnpjp2.so in my opera plugin folder (which is different from the systems plugin folder for the other browsers) did the job.
in fact, the icedtea-plugin doesn't work on my machine

echoes1 Sunday, June 27, 2010 10:13:11 PM

interesting... i have noticed ruari that my java is not detected here: http://www.java.com/en/download/help/testvm.xml
(however, it IS detected by opera, just like flash is).

java-1_6_0-openjdk 1.6.0.0_b17-2.1.1 x86_64
java-1_6_0-openjdk-plugin 1.6.0.0_b17-2.1.1 x86_64
Opera 10.60.6383
OpenSUSE 11.2 x86_64

as you also might remember, flash is not working for me either. i had not noticed java not working i guess because i never visit sites that require it. so there you have it: java AND flash don't work for me on opensuse so i guess this might apply to more than just ubuntu, as you alluded to.

a lot of people have also reported non-working flash on other distros too, such as ubuntu & gentoo.

i'm willing to bet that i'm not the only one with non-working java as well as flash.

UPDATE:

i uninstalled icedtea java & its plugin & installed sun java & its plugin as per your recommendation. just like flash it is detected by opera but (still) does not work.

Patkos Csabapatkoscsaba Monday, June 28, 2010 11:04:43 AM

Still ... on Mandriva x86_64 all works fine. Both flash 10 64b and java-plugin-sun 64b are detected and operate as expected.

Gilde Thursday, July 15, 2010 6:56:25 PM

With the latest update of openjdk6 and icedtea-plugin opera recognizes the icedtea plugin :-)

opera:plugins shows me:
IcedTea NPR Web Browser Plugin (using IcedTea6 1.8 (6b18-1.8-4))

Using sidux (debian unstable) with opera build 6386

Anonymous Friday, July 16, 2010 8:40:32 AM

parik70 writes: Hi my friend! I just used your indications to get iceated open java PROPERLY workin with opera 10.6. I0've got to say I've got ff 3.6.6 so I changed the versione in the path of files I'vwe got to copy but now open Java works on my ubuntu 10.04! Thanks a lot!!!

Ruarí Ødegaardruario Tuesday, July 27, 2010 12:17:09 PM

The Ubuntu bug is now marked as fixed and testing on my own system (without the work around in place), it does indeed work.

If you are an Ubuntu user and were using a working around you should probably remove your work around as it may cause you other issues later.

berend ytsmaytsmabeer Tuesday, August 3, 2010 10:47:28 AM

I can confirm it is working.
But would be great that I knew it before I installed suns java, just five min ago.

But a great job Opera