HOWTO: Installing Oracle’s Java plugin on an SELinux-enabled system

As tested on Fedora 14 x86_64, with Sun JRE 6u23, Firefox 4 and Google Chrome.

That this works was a pleasant surprise to a friend and I — he thought the Java plugin does not work with Chrome, and I did not realize the 64-bit version is out (OpenJDK has had a plugin since it was called IcedTea, but the Java applets I need to use tend to make use of the Sun/Oracle binary blobs not yet reimplemented).

Getting it to work with Chrome is straightforward — like with Flash, you symlink $JRE_HOME/lib/amd64/ to /opt/google/chrome/plugins. With Firefox 4, though, SELinux comes into play. Presumably because while Chrome’s executable is already marked as requiring an executable stack, Firefox 4’s (or rather, XULRunner 2’s) is not.

No big deal, you might think. The SELInux troubleshooter pops up, just follow its suggestions and all shall be well — pipe the relevant audit log lines to audit2allow, load the generated policy modules, close Firefox and try again. Except for… no cheese.

If this happens to you, save yourself trying to delete the symlink, reload Firefox, closing, recreating the symlink, and trying again. It appears that Firefox tries to cleverly remember which plugins fail to load, and it’s this cache that you need to purge. Delete ~/.mozilla/firefox/*.default/pluginreg.dat, and you’d be set on the next restart.