Install Java browser plugin in Gentoo


To run Java code on a Gentoo system you must have a JRE (Java Runtime Environment) installed. The JRE will install a 32-bit browser plugin, among other things, which is necessary to take advantage of Java applets in Firefox.

Before we go any further, it must be noted that this will only work with the 32-bit version of Firefox. This is because the binary JRE package is only distributed in 32-bit and is therefore incompatible with the 64-bit version of Firefox. If you run a 64-bit system make sure that you have emerged the www-client/mozilla-firefox-bin package to get the 32-bit browser.

There are numerous JRE packages within portage, but the recommended package to emerge is dev-java/sun-jre-bin. Don’t confuse the JRE with JDK (Java Development Kit) which will add unnecessary Java programming tools to the installation.

To get the browser plugin you must enable the nsplugin USE flag when emerging the JRE. You can add this to your global USE flags by placing it directly into the make.conf file.

If you don’t want every package capable of installing a plugin to do so, you can limit the flag to this package only by adding the following entry to /etc/portage/package.use.

Once the nsplugin flag is set to your liking then go ahead and emerge the JRE.

The ‘-v‘ and ‘-a‘ options will allow you view the USE flags that are enabled, and confirm they are correct before allowing it to continue.

If you are running an amd64 system then you will need to emerge the app-emulation/emul-linux-x86-java package as well. This package contains the basic 32-bit libraries needed to run the 32-bit JRE binaries on your 64-bit system.

You will need the nsplugin USE flag enabled for this package as well. If you didn’t add the keyword to your global USE flags in the previous step, add the following entry to /etc/portage/package.use.

Now emerge the package, again making sure the USE flags are correct.

You will now have to configure your system to use the JRE with the eselect command utility.

Use this for a x86 system.

Use this for an amd64 system.

Once all of these steps have been completed you can verify that everything is correct by running.

Check that Firefox has found the plugin by opening up a new window and entering about:plugins in the address bar. You should now see the Java plugin listed.

  • Janusz

    Great stuff! However I didn’t have to install app-emulation/emul-linux-x86-java on 64bit box – it’s working with sun-jre-bin-1.6. AFAIK java applets are executed from byte code, so they should work on both 32bit and 64bit environments (at least in theory).

  • Wastl

    Having found this page too late, I got it to run on my own after a lot of trying around. The key thing seems to have been, after installing the latest sun-jdk, to symlink certain files from or below /opt/sun-jdk- into $HOME/.mozilla/plugins . I ended up with the following of these symlinks (all in ~/.mozilla/plugins directly, no subdirs on that side):
    when it turned out to run (all in 64-bit, it seems) finally, so I didn’t dare to fiddle around any more to test which of those are really necessary.

  • Carlos

    Acabo de realizar los pasos descritos aqui y funciona perfectamente.
    Gracias, Thanks.