This starts out a little off-topic for this site; but, as it comes from after spending a couple of hours this evening hacking on and thinking about a software problem, I think it belongs here.
Sun recently released a Linux x86_64 version of their new Java browser plugin, libnpjp2.so. This is really great news for anyone running 64-bit Linux as it means Java applets can now run in the Sun JVM without resorting to installing a 32-bit browser. Of course, given how recently this was released, it hasn't made it into many distributions yet. Fortunately, according to the Internet, it's as easy as unpacking the JRE somewhere sensible (which means not in OS-controlled directories like /usr/lib/jvm; try your home directory, /usr/local, or /opt) and making a symlink to libnpjp2.so from ~/.mozilla/plugins.
After downloading the latest JRE (1.6.0_13 at this time) I realised that it was a binary installer. I hate binary installers. The Windows software culture that makes it easy to fool users into running random things (such as malware, including trojan horses and DRM rootkits) as Administrator is rooted in the custom of binary installers. Now, as binary installers go, this wasn't the most horrible one that I've seen, as it doesn't demand to be run as root, and as it's actually a shell script sitting on top of what appears to be a self-extracting ZIP file, but it was still a binary installer, and the self-extracting ZIP file was still a binary blob. I didn't run it. Instead, after picking it apart and seeing what it was, I just unzipped it. The whole file, shell script and binary blob claiming to be a self-extracting ZIP file and all, went through unzip, which detected the ZIP header buried inside and started from there.
I really wondered why Sun tried to make me jump through hoops just so I could unzip some files. I can't imagine they believe the license is any more or less enforceable as a result of displaying it, especially since it can be cleared after showing just the first screenful.
However, after making the symlink to the plugin inside the newly extracted JRE, Firefox (3.0.8 as packaged in Ubuntu Intrepid) would crash out as soon as I loaded any applet, printing the following:
Error occurred during initialization of VM
java/lang/NoClassDefFoundError: java/lang/Object
I tried setting JAVA_HOME and even PATH, as some forum posts suggested, and I even tried moving aside /usr/lib/jvm temporarily to see if there was an unfathomable conflict. It didn't help.
Finally, I stumbled upon the answer by doing something I should have done earlier: I inspected the binary installer more closely. It turns out that it doesn't simply execute the self-extracting ZIP file. It also meddles around in the newly extracted directory and packs up some jar files. (I knew that; the JRE/JDK installer has been doing this dance for as long as I can remember, which is apparently not very long at all.) With that remembered fact in mind, I set up another user on the machine, switched into it, and ran the binary installer. It executed the self-extracting ZIP file, meddled around in the newly extracted directory, and exited successfully, leaving one directory containing the extracted and meddled JRE. Then, after I moved the correctly "installed" JRE somewhere sensible, applets loaded and all was well.
The lesson here is that binary installers are a gigantic failure. The Unix software culture does not include their use. Certainly half-clued software vendors have been hawking software for Unix systems that come as a binary installer for decades, but this is a distasteful exception. What purpose do binary installers serve? If they merely produce files in a directory, then there are many trustable ways of achieving this; if the user is suspected of being inept, a shar file accomplishes the same thing with full transparency. If they meddle around in the system, especially with root privileges, well, they shouldn't! With complicated OS detection functions they needlessly restrict their use to specific releases from specific vendors, almost always severely out of date; and without they make invalid assumptions about the system and trample all over it. Worse, as I suggested above, they train the user into believing that it's normal to run things without thinking, perhaps even as root, and that notion is a security vulnerability that absolutely cannot be removed once it's been installed in the user's mind.
The other lesson is that, when encountering a binary installer, it often pays to pay close attention to what it does. I think that holds true whether one decides to run it or not.
Getting the plugin to run in the end was a bonus, though a really nice one.