Dependency Problem Installing sun-java6-plugin

The other day I tried to use a Java applet in my Chromium Browser on Ubuntu 9.10. The other day I found out I didn't have the java plugin. I also had a bit of trouble installing the plugin package for Firefox/Chromium/Chrome. You can check the plugins loaded in Chromium/Chrome by typing the following into the URI bar:


In my case, there was no mention of Java-anything. From a bit of searching I saw I needed a plugin package called sun-java6-plugin, neat right? Well, it seems there's an issue installing if you update from Ubuntu 9.04 to 9.10 (I'd imagine similar issues from earlier versions too, but I'm not sure.) The problem is, there are separate packages for the same version of Java for both Ubuntu versions. Naturally I had the Java bin/JRE from 9.04 and the uninstalled plugin package depended on the bin/JRE from 9.10. Finally, the bin/JRE from 9.04 blocked the corresponding packages from 9.10. The specific error:

sun-java6-plugin: Depends: sun-java6-bin (= 6-15-1) but 6-16-0ubuntu1.9.04 is to be installed

So, after a few searches I found that uninstalling sun-java6-bin/jre, then reinstalling will pull in the 9.10 package, which is compatible with the desired 'sun-java6-plugin' package. The issue with this is: apt-get will want to remove all the Java-associated packages you have installed, as removing Java will break their dependencies. :O Here's what I found, use dpkg to forcefully remove the Java bin/JRE packages, then let apt-get rebuild the dependencies through non-sun Java packages.

dpkg -r --force-all sun-java6-bin sun-java6-jre
apt-get install -f
apt-get install sun-java6-bin sun-java6-jre sun-java6-plugin

This process will pull in a few unneeded packages, but will prevent apt from removing all your Java-based applications (which for me included a highly-configured Eclipse). In my case, I couldn't afford any hic-ups with removing and reinstalling packages.