So apparently many Linux developers don’t like the license that comes with Sun’s Java/JDK implementation. As a result, Ubuntu’s default implementation is OpenJDK, an open source alternative. The more conservative Debian doesn’t ship with any JDK installed.
For the most part, the Sun JDK and OpenJDK are identical. However, one area in particular where OpenJDK support is poor is Java Web Start. I recently traced a very frustrating issue to some sort of bug in OpenJDK’s web start support, and just yesterday a colleague in my lab experienced a similar problem. I helped her install Sun’s JDK and the issue was resolved.
Since I’ve had to install Java a few times recently, I’ve been thinking about “the right way” to manage Java installations on my machine. One of my undergrad professors told me horror stories about software that required specific (older) versions of Java and the pain of managing the current version along with the older versions. I don’t know if I’ll ever have to deal with that, but I’ve come up with a strategy today that I think will work well.
Download the latest JDK from Sun’s website, open a terminal, and then change to the download directory. The following commands will then install Java on your machine. Note: slight adjustments may be necessary if you’re not using a Debian-based distribution.
sudo mkdir /usr/local/java chmod 755 jdk-6u24-linux-x64.bin ./jdk-6u24-linux-x64.bin sudo mv jdk1.6.0_24/ /usr/local/java/. sudo ln -s /usr/local/java/jdk1.6.0_24 /usr/local/java/jdk sudo sh -c 'echo "export PATH=/usr/local/java/jdk/bin:\$PATH" >> /etc/bash.bashrc'
Then, if you ever need to install a different version of Java, you can repeat steps 2-4 with the new version (and step 5 if you want to make the new version the system-wide default).