Configuring Oracle JDK 7 on Ubuntu

This has been a fairly frequent issue plaguing people both here in the lab and trying to use XNAT on Ubuntu workstations recently (I assume the same would apply to most Debian flavors of Linux). There are some issues with the OpenJDK and IcedTea plugins that are hosted on the standard Debian repositories that cause applets to not work at all, work incorrectly, or generally make it difficult to get things done. The fix for most of these issues is to install and use the Oracle JDK, but the problem there is that the Oracle JDK has been pulled from the standard Debian repositories due to licensing issues.

Luckily, there’s a fix for this and it’s documented here. We've lost a number of hours spinning our tires trying to get this issue fixed, so hopefully this will save others some of our pain! I went through this last night with a virtual machine that I was setting up and it worked quite well.

The only further issue I needed to deal with was the fact that I'd set JAVA_HOME in my .bashrc file to point to one of the OpenJDK implementations and added $JAVA_HOME/bin to my path. Once I set JAVA_HOME to point to the new Java installation folder (on Ubuntu 12.04 that ended up being /usr/lib/jvm/java-7-oracle) and removed $JAVA_HOME/bin from my path (by setting the JVM alternative to java-7-oracle, the binaries in /usr/bin should be automatically linked to the Oracle JDK installation), everything worked as it should, including being able to run applets correctly!