Mozilla Firefox/Java
From Gentoo Linux Wiki
Contents |
[edit] About
This guide explains how to install Java plugins so that they will work with the Mozilla Firefox browser.
[edit] Install Required Software
[edit] Mozilla Firefox
Install Mozilla Firefox with the java USE flag. You can check to see if it is enabled using app-portage/eix.
eix firefox
If the java USE flag is not enabled, you can enable it by adding it in the /etc/portage/package.use
echo "www-client/mozilla-firefox java" >> /etc/portage/package.use
or to the global USE flag file, /etc/make.conf.
In both cases, recompile firefox using:
emerge -avN mozilla-firefox
[edit] Java
There are a couple of different Java Virtual Machines (JVM) that can be installed in Gentoo. For the purpose of this Wiki, you'll be given the option to install Sun's JVM or Blackdown Java. Either way, you will need the nsplugin USE flag, either on the command line or in your make.conf.
[edit] Sun JRE
The Java Runtime Environment, which comes directly from Sun Microsystems can be retreived by doing:
echo "dev-java/sun-jre-bin nsplugin" >> /etc/portage/package.use emerge -av sun-jre-bin
or if you will be using the SDK:
echo "dev-java/sun-jdk nsplugin" >> /etc/portage/package.use emerge -av sun-jdk
[edit] Blackdown JRE
The Blackdown JRE is a Sun related version of Java that is also available for non-PC platforms and it does not require a license acceptance like the Sun's version does. However, some people say that it is slower than Sun's version of the JVM. To install Blackdown JRE on your system, type the following command
echo "dev-java/blackdown-jre nsplugin" >> /etc/portage/package.use emerge blackdown-jre
[edit] Setup Firefox With Java
First, you must make sure Java is enabled in Firefox. Do this by opening Firefox and going to Edit ยป Preferences and then opening up the Web Features or the Content section. Make sure that the Enable Java option is checked.
[edit] The Gentoo way
The new dev-java/java-config in portage introduces a cleaner way of configuring things related to Java. As root, run to see your type and version:
# eselect java-nsplugin list Available Java browser plugins [1] sun-jdk-1.5 [2] sun-jdk-1.6 current # eselect java-nsplugin set plug-in
Replacing plug-in with the appropriate item listed in the first command.
[edit] Symlinking Java to Firefox
If Java still does not work with Firefox, you must make a symlink to the Java plugin so that Firefox can recognize it. First, you must locate the Java plugin by searching your system.
[edit] Finding the plugin
[edit] With slocate
If you have emerged sys-apps/slocate, then do the following:
# updatedb # locate javaplugin_oji.so
Use the path that was returned by locate and link the plugin to Firefox in one of two ways mentioned in the symlinking section below.
[edit] With find
This method may take a little bit longer than slocate, but won't require a database update. To use this method sys-apps/findutils is required, which is standard in Gentoo Linux. Multiple hits may be found; you may have to try the next step a couple times with different paths until you find one that works.
find /opt -name javaplugin_oji\*
If this method does not find the sun plugin; try
find /opt -name "*javaplugin_oji*"
[edit] Symlinking the plugin
[edit] Link current user
This method will only allow the current user to use the Java plugin.
ln -s <path-to-java-plugin> ~/.mozilla/plugins
| Note: You will need to make sure you link with the correct plugin for your version of GCC. To find out your current version of gcc execute: gcc -v. For instance at the time of writing gcc-3.4.3 is what came with my Gentoo. From the IBM java vm, the correct library to link is /opt/ibm-jre-bin-1.4.2/bin/libjavaplugin_ojigcc3.so and NOT the one described here. This may applies to other VMs too. |
[edit] Link Globally
If you have a system with multiple users, or you want the plugin available to any users that may exist in the future, you have to link it globally. To do this, run the following commands:
# ln -s <path-to-java-plugin> /opt/netscape/plugins/
To get the benefit of any update to the system VM, you need to use the VM specified by the java-config-2 command since there is a symlink to the current VM in /etc/java-config-2/. Therefore, issue the following command:
# ln -s /etc/java-config-2/current-system-vm/jre/plugin/i386/ns7/libjavaplugin_oji.so /opt/netscape/plugins/
If you are using Sun JDK 1.6 with Firefox 2.0.0.11, you can do the following:
# ln -s /opt/sun-jdk-1.6.0.03/jre/plugin/i386/ns7/libjavaplugin_oji.so /usr/lib/mozilla-firefox/plugins/
[edit] Troubleshooting
[edit] Xlib.lock failed
If firefox found java (type about:plugins in adress line) and java still doesn't work. Try to start it from a terminal. Errors like "java_vm: xcb_xlib.c:50: xcb_xlib_unlock: Assertion `c->xlib.lock' failed." you can fix with instructing portage to disable assertions in libxcb. To achieve this, create the file /etc/portage/env/x11-libs/libxcb with following content:
CFLAGS="${CFLAGS} -DNDEBUG"
and run emerge -av libxcb.
