How to switch Firefox Java plugin to Sun Java on Ubuntu Linux
When I recently tried to open my favourite Java webcam applet in Firefox on Ubuntu Natty 11.04, I was surprised to find that it wasn't working. Issues with legacy Java applications are common now that the Java world is moving towards OpenJDK as the future standard. In certain cases you may have to use an older version of Java to get your applet to work. This will tell you how to install Sun Java 6 and set your system to use it as the default virtual machine for local Java applications and web applets in your browser.
Open Synaptic and go to Settings –> Repositories –> Other Software and activate the Canonical partner repo. Now close Synaptic, fire up a terminal and run the following commands in the order specified, selecting Sun Java (java-6-sun) where appropriate:
sudo apt-get update
sudo apt-get install sun-java6-bin sun-java6-fonts sun-java6-jdk sun-java6-plugin
sudo update-alternatives --config java
The tricky part is: even when you have Sun's Java runtime installed, Firefox will still default to the open source IcedTea (OpenJDK) plugin, unless you tell it not to. Run the following command and select Sun's Java web browser plugin:
sudo update-alternatives --config mozilla-javaplugin.so
Credits go out to Yulei.Liu.AU from IBM's Netcool Tips. Thanks!