Java/How To use Java with Firefox on 64-bit openSuSE 10.3
From openSUSE
Contents |
Sun's Java x86_64 plugin
This HOWTO is obsolete, because Sun released Java 6 u12 with native 64bit plugin. The package is in update process and will be available soon via online update. So for 64bit plugin, just install a java-1_6_0-sun-plugin package and that's all.
That's all unless you still use openSUSE 10.3, because there's no java-1_6_0-sun-plugin package available. This plugin is not compatible with Firefox2, distributed by 10.3. You can update to a newest release, or
- install a Firefox3 from mozilla/openSUSE_10.3 repository
- make a symbolic link in
~/.mozilla/pluginsto/usr/lib64/jvm/java-1.6.0-sun-1.6.0/jre/lib/amd64/libnpjp2.so. Remove any stray preexisting symlinks to the libjavaplugin_oji.so library.
Warning: until there's a java-1_6_0-openjdk package available, so the package java-1_6_0-openjdk-plugin contains a native 64 bit plugin matters remain complex. See Java/How to use Java with Firefox on 64-bit openSuSE 11.0 but its as easy as via YAST using the package java-1_6_0-openjdk-plugin to get java applets working. The article OpenJDK contains more informations about OpenJDK in SUSE.
Release Notes for the Next-Generation Java™ Plug-In Technology
An approach using KDE
In 64 bit 11.0 running KDE 3.x (it should work on 64 bit 10.3 KDE) you can paste the URL in Firefox that accesses the java applet that gives you the absent plugin message into Konqueror and the applet runs.
Alternative approaches using packages from SUSE repositories
See end of this article for variations (like getting the Java plugin to work with FireFox).
Installing a standalone 32-bit version of Java and Firefox
Overview
x86_64 or 64-bit Linux, such as openSuSE 10.3, does not have a 64-bit Sun Java plugin for web browsers. Also, the i386, or 32-bit, plugin cannot be used with 64-bit web browsers such as Firefox.
Here is a work-around that, which keeps the 64-bit Firefox installation intact.
Traditionally, neither Jajava-1_6_0-openjdk-pluginva nor Firefox were installed 'sitewide' or as part of a distribution. Both Sun Java and Firefox come from a history of local, per-user installations. This can be used on a 64-bit system to create local, personal 32-bit Firefox, which will run the 32-bit Java plugin. Or alternatively, 32-bit Java and Firefox can be installed as standalone under /usr/local/, cleanly separated from the official directory tree and available to all users at the same time.
The cons are that only the 32-bit Firefox will use this 32-bit Java and that you have about 30mb of software installed just to visit freearcade.com. In addition, in the local installation, only you can use this version of Firefox, while the central installation requires root access. Another con is that these versions of Firefox and Java will not be patched by the automated YaST Online Update. You need to repeat the download and installation when a new version becomes available. Finally, add-ons installed on the 64-bit version are not recognized by the 32-bit version.
The pros are that you don't have to mess with update alternatives and package conflicts created by installing the RPMs of another version of Java that is incompatible with everything else on the system. You can copy the whole directories with Java and Firefox and know you have a working and complete Java on the web experience no matter what 64-bit Linux you use. Since bookmarks are stored in your ~/.mozilla directory, they are available to both versions of Firefox.
Decide if you prefer a local or central installation method and follow the corresponding instructions below.
Preparation
If you have openSUSE package 'java-1_6_0-sun-plugin' installed, uninstall it.
Install a 32-bit compatibility environment.
Download the tarball, not rpm, version of the Sun Java 32-bit Runtime (jre). Be sure to select the Linux (self-extracting file) version and Not the RPM version.
Download the Firefox distro for your language from Mozilla. The Linux downloads on this page are 32-bit tarballs, which is just what you need.
Installation
Local Installation in User Account
Creating a special sub-directory to hold all the files is useful. I create a bin directory in my $HOME as part of any new Linux account I am given. Since users eventually collect a lot of small tools, scripts or applets you may already have one.
mkdir ~/bin
Change to this directory.
cd ~/bin
and untar the files you downloaded earlier. This will create a firefox installation bellow the current directory.
tar -xvf /path/to/firefox-2.0.0.8.tar.gz
The java download is contained in a binfile which is just a shell script much like the old Loki installers or a self-extracting "sharchive." Run this bin file and accept the license to unpack the full java install.
sh /path/to/jre-6u3-linux-i586.bin
In my case, I now have
$HOME | +-/bin | +-/firefox | +-/jre1.6.0_03
Central Installation in /usr/local/
Another option is to install the downloaded 32bit standalone versions of Firefox and JRE under /usr/local, so it gets intalled only once and it can be accessed by any user in the system. There is no need to adapt any user settings, since /usr/local/bin is included in the user's $PATH by default.
While the local installation can be performed by any user, the central installation can only be done by root (or if user has sudo priviledges):
su - cd /usr/local tar -xvf /path/to/firefox-2.0.0.8.tar.gz sh /path/to/jre-6u3-linux-i586.bin
Post-install
Local Installation in User Account
If you start the ~/bin/firefox/firefox browser now, it won't know what Java to use. Install the plugin manually by linking it.
ln -s ~/bin/jre1.6.0_03/plugin/i386/ns7/libjavaplugin_oji.so \
~/bin/firefox/plugins/libjavaplugin_oji.so
Since this is locally installed, your environment still reflects the system-wide installation of Java. A script fixes that and a few common problems with the installation and execution:
vi ~/bin/firefox32
Which should contain:
#!/bin/bash # Firefox32 with JRE for openSUSE 64b (by Waveclaw and CFLange) # Note: Uninstall openSUSE package "java-1_6_0-sun-plugin", if installed. # This software is provided without warranty. # directory where standalone Firefox 32bit and JRE are installed export PARENTDIR=$HOME/bin #check if regular Firefox is running if [ "`ps -ef |grep /usr/bin/firefox|grep -v grep`" != "" ] then echo "Please, close regular Firefox first." exit fi #customized java environment export JAVA_HOME=$PARENTDIR/jre1.6.0_03 export JAVA_ROOT=$JAVA_HOME export PLUGIN_HOME=$JAVA_HOME/plugin export JAVA_BINDIR=$JAVA_HOME/bin # good ol' classpath export CLASSPATH=$JAVA_HOME/lib #fix xlib locking issues export LIBXCB_ALLOW_SLOPPY_LOCK=1 # add the 32-bit libs and the java, firefox binaries to my path export LD_LIBRARY_PATH=$CLASSPATH:/lib:/usr/lib export PATH=$PARENTDIR/firefox/:$JAVA_HOME/bin:$PATH # run the 32-bit firefox web browser, now with Java! $PARENTDIR/firefox/firefox $@ EOF
Make the script executable.
chmod +x ~/bin/firefox32
You are done.
Running ~/bin/firefox32 will start a web browser with Java support on your 64-bit Linux installation.
Central Installation in /usr/local/
As described above, the new installation of Firefox needs to be made aware of the 32-bit version of the Java plugin:
ln -s /usr/local/jre1.6.0_03/plugin/i386/ns7/libjavaplugin_oji.so \
/usr/local/firefox/plugins/libjavaplugin_oji.so
Finally, to run the 32-bit Firefox with its own separate environment, avoiding conflict with the official 64-bit version and its plugins, create a new script in /usr/local/bin:
vi /usr/local/bin/firefox32 <pre> Which should contain:
- !/bin/bash
- Firefox32 with JRE for openSUSE 64b (by Waveclaw and CFLange)
- Note: Uninstall openSUSE package "java-1_6_0-sun-plugin", if installed.
- This software is provided without warranty.
- directory where standalone Firefox 32bit and JRE are installed
export PARENTDIR=/usr/local
- check if regular Firefox is running
if [ "`ps -ef |grep /usr/bin/firefox|grep -v grep`" != "" ]
then echo "Please, close regular Firefox first." exit
fi
- customized java environment
export JAVA_HOME=$PARENTDIR/jre1.6.0_03 export JAVA_ROOT=$JAVA_HOME export PLUGIN_HOME=$JAVA_HOME/plugin export JAVA_BINDIR=$JAVA_HOME/bin
- good ol' classpath
export CLASSPATH=$JAVA_HOME/lib
- fix xlib locking issues
export LIBXCB_ALLOW_SLOPPY_LOCK=1
- add the 32-bit libs and the java, firefox binaries to my path
export LD_LIBRARY_PATH=$CLASSPATH:/lib:/usr/lib export PATH=$PARENTDIR/firefox/:$JAVA_HOME/bin:$PATH
- run the 32-bit firefox web browser, now with Java!
$PARENTDIR/firefox/firefox $@
EOF </pre>
Make the script executable.
chmod a+x /usr/local/bin/firefox32
You are done.
Running firefox32 will start a web browser with Java support on your 64-bit Linux installation.
Notes
This is intended to get Java working in a web browser when you need it. No other support, such as using the 32-bit Firefox to play videos, is assumed or covered.
Close all instances of Firefox before switching between 64-bit and 32-bit versions. If you are running a 32-bit browser already and try to start a 64-bit Firefox browser, you will instead open another 32-bit browser window. When Firefox detects an existing running copy, it will open a new window with that copy instead of starting another web browser. The detection is not very smart - it fails to differentiate the two versions even if different profiles are used. For example, firefox32bit -P 32bit & followed by firefox64bit -P default & opens two 32-bit windows using the 32bit profile. The script above warns you about that, at least in the case of trying to run a 32-bit instance, when another 64-bit instance is already running.
Note that, if you have installed the openSUSE package 'java-1_6_0-sun-plugin', you have to uninstall it first.
Alternative approach
The Sun's Java
I was willing to use the 32bit version of Firefox as the primary browser. The following approach uses java 1.6.0 64bit for OpenOffice, etc., and java 1.5.0 32bit for the plugin. It works for me. (You'll need to make your own modifications, based on your original package selections).
Each of these bullets needs to be a separate iteration of the installer.
- Remove 64bit (x86_64) Firefox.
- Install the 32bit (i586) version.
- Leave java-1_6_0_sun installed, but remove java-1_6_0-sun-plugin.
- Remove 64bit java-1_5_0_sun and the corresponding plugin.
- Install 32bit java-1_5_0_sun.
- Install 32bit java-1_5_0_sun-plugin.
As always, YMMV.
OpenJDK and IcedTea
Thanks to the efforts of Bernhard Kaindl, the Factory repo now contains an OpenJDK and IcedTea implementation of Java, both of which provide a plugin for 64-bit browsers under 64-bit Linux!
The installation procedure was moved to main article OpenJDK.
User Notes
64-bit Machines & the FireFox JavaPlugin
- If you have 64-bit FireFox installed (yay!) then you have to use openJDK's plugin (boo!). openJDK's plugin works on about 50% of the applets out there; so, to be useful you should install a pure 32-bit FF+Java plugin setup. Keep reading.
The solution is, (hang your head in shame -- you're about to install a bunch of 32-bit apps):
- remove 64-bit FireFox
- remove openJDK
- install 32-bit FireFox
- See the Versions tab in YaST. If this tab is blank, select another program beneath "FireFox" and then reselect FireFox. This cheat allows you to now select the 32-bit version
- install the 32-bit xul-runner190s
- mozilla-xulrunner190-translations-32bit
- mozilla-xulrunner190-32bit
- mozilla-xulrunner190-gnomevfs-32bit
- install 32-bit Java
- java-1_6_0-sun-alsa-1.6.0.u7-1.1
- java-1_6_0-sun-jdbc-1.6.0.u7-1.1
- java-1_6_0-sun-devel-1.6.0.u7-1.1
- java-1_6_0-sun-1.6.0.u7-1.1
- java-1_6_0-sun-demo-1.6.0.u7-1.1
- java-1_6_0-sun-plugin-1.6.0.u7-1.1
Categories: Java | HOWTOs | Installation

