Sunday, October 18, 2009

Sun Java plugin for Fedora 10

Out of the box, you'll find Java applets don't work in Firefox under Fedora 10.

To fix this, you probably want to remove the default Java VM from the machine and replace it with the Sun JVM, which supports applets properly.

The steps required are as follows:

Optionally, find out what provides the Java runtime you are using currently if you think you may have changed it since the original Fedora 10 install. I used a command like this:-
# rpm -q --whatprovides /usr/lib/jvm/jre-1.5.0-gjc/bin/java
You can remove the installed Java packages to get to a clean slate like this:
# rpm -e gcc-java
# rpm -e java-1.5.0-gcj-devel
# rpm -e eclipse-ecj
# rpm -e java-1.6.0-openjdk-plugin-1
# rpm -e java-1.6.0-openjdk

Rpm will complain if you get the ordering of removals wrong, I'll note the order more carefully the next time I run through these steps, one or two may have been transposed.

Next, get the 1.6 SDK from http://java.sun.com, picking the Linux distribution, probably without the extra bundled software unless you are going to use Sun's IDE or the Glassfish appserver. You'll download a file called jdk-6u16-linux-i586-rpm.bin if you do this in October 2009.

You need to make the file executable, and run it (you'll need to precede the name with a "./" unless your current working directory is on the path, which is a poor practise from a security
standpoint). The script will ask you to accept license conditions and will try to pop up a browser window for registering your download, though this was broken when I tried to use it tonight.

You'll discover 7 rpm files appear when the script has done its work, and the JDK has been installed under /usr/java.

To get the Sun JVM to start up, you need to do this next:-
/usr/sbin/alternatives \
--install /usr/bin/java java /usr/java/latest/bin/java 1
This sets up symbolic links correctly to /usr/bin/java, but only when you run this next, to tell the system that you want to choose the Sun JVM over the original gcc Java 1.5 VM:-
/usr/sbin/alternatives --config java
Pick the option presented by the menu to swap alternatives around.

Nearly there.

Now assuming that you are on an i386 linux pc, you'll need to install the applet plugin into the firefox plugins folder, like this:-
cd /usr/lib/mozilla/plugins && ln -s /usr/java/latest/jre/lib/i386/libnpjp2.so
Now if you stop all Firefox instances and restart, you should find that applets load properly.

Thanks to angusman for his post here on doing the same ops for Centos on 64bit AMD architecture: http://blog.taragana.com/index.php/archive/how-to-install-enable-java-plugin-applets-in-firefox-on-centos-5/

0 Comments:

Post a Comment

<< Home