Wednesday, February 29, 2012

How to run with JRE 1.4.2 on Linux

I needed to test an old applet against Java 1.4.2, so I went on the question of running Firefox on Linux with JRE 1.4.2.

First of all, Oracle requires registering:

The first page led me to this download page which required that I register, so I did, and was finally able to download the file j2re-1_4_2_19-linux-i586.bin

I put the file on a Fedora 32-bit virtual machine and extracted it by running

chmod +x j2re-1_4_2_19-linux-i586.bin
./j2re-1_4_2_19-linux-i586.bin

After clicking through the license agreement, the directory j2re1.4.2_19 was created.

I used this page to determine the plugin directory on Linux:

$HOME/.mozilla/plugins
program_directory/plugins
/usr/lib/mozilla/plugins
/usr/lib/xulrunner/plugins

So I started by

cd ~/.mozilla/plugins
ln -s /home/javasux/j2re1.4.2_19/plugin/i386/ns4/libjavaplugin.so .

But when I ran Firefox, and browsed to about:plugins, it gave me the following error:

LoadPlugin: failed to initialize shared library /home/javasux/j2re1.4.2_19/plugin/i386/ns4/libjavaplugin.so [/home/javasux/j2re1.4.2_19/plugin/i386/ns4/libjavaplugin.so: cannot restore segment prot after reloc: Permission denied]
LoadPlugin: failed to initialize shared library /home/javasux/j2re1.4.2_19/plugin/i386/ns4/libjavaplugin.so [/home/javasux/j2re1.4.2_19/plugin/i386/ns4/libjavaplugin.so: cannot restore segment prot after reloc: Permission denied]
[WARN 10071] polkit-session.c:144:polkit_session_set_uid(): session != NULL
 Not built with -rdynamic so unable to print a backtrace

I could not figure out what the problem was. There are other posts linking to this problem, but none of them have a solution that worked for me. What did work for me was following the directions in this post and running:

/usr/sbin/setenforce 0

Now when Firefox ran, it showed me two Java plugins! The system Java plugin, and the 1.4.2 plugin I had installed. Going to this and this website confirmed that I was running Java 1.6, when I wanted 1.4.2.

So, I temporarily disabled the Java version on my system by running the following commands:

sudo mv /usr/lib/mozilla/plugins/libjavaplugin.so /usr/lib/mozilla/plugins/libjavaplugin.so.bak
sudo mv /etc/alternatives/libjavaplugin.so /etc/alternatives/libjavaplugin.so.bak

Now when I run Firefox, about:plugins shows me the 1.4.2 plugin loaded, but the test websites tell me that I don't have Java installed!

The java.com website says that I need Java 6 Update 10 and above for Firefox 3.6 and later versions. Well, I'm running Firefox 3.5b4, but maybe they're on to something, so upon searching, I find the Mozilla download for Firefox 3.0.19.

wget ftp://ftp.mozilla.org/pub/mozilla.org/firefox/releases/3.0.19-real-real/linux-i686/en-US/firefox-3.0.19.tar.bz2  
tar xfj firefox-3.0.19.tar.bz2
cd firefox
./firefox

It's still not working! So I'm giving up and finding a machine that already has an old Firefox installed with an old Java version.

0 comments:

Post a Comment