Install Java browser plugin in Gentoo

by
on
November 2, 2008

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.

dev-java/sun-jre-bin nsplugin

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

# emerge -av dev-java/sun-jre-bin

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.

app-emulation/emul-linux-x86-java nsplugin

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

# emerge -av app-emulation/emul-linux-x86-java

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

Use this for a x86 system.

# eselect java-nsplugin set sun-jre-bin-1.6

Use this for an amd64 system.

# eselect java-nsplugin set 32bit emul-linux-x86-java-1.6

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

# eselect java-nsplugin list
Available 32-bit Java browser plugins
  [1]   emul-linux-x86-java-1.6  current
Available 64-bit Java browser plugins

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.

3 Comments
gentoo
, , , , , , , , , , , , , , ,

Related posts:

  1. Update your entire Gentoo Linux system
  2. Speed up Gentoo emerge with “parallel-fetch”
  3. Upgrade Gentoo Linux Kernel
  4. Setup NFS server on Gentoo
  5. View the status of a long emerge

Comments (3)

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).

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-1.6.0.20/jre/lib/ into $HOME/.mozilla/plugins . I ended up with the following of these symlinks (all in ~/.mozilla/plugins directly, no subdirs on that side):
amd64/libjavaplugin_jni.so
amd64/libnpjp2.so
plugin.jar
locale/de/LC_MESSAGES/sunw_java_plugin.mo
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.

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

Trackbacks (0)

No trackbacks yet

Leave a Comment

(displayed with your post)
(will not be published)
(optional)

Copyright 2008-2010 WiredRevolution.com. All rights reserved.