How to configure Java on Ubuntu

I’ve got a few Ubuntu systems lying around, and I’ve recently started playing around with Apache Hadoop.

I had several versions of the jdk installed including the one I wanted “sun-java6-jdk” however the gcj one was the default system.

There are two steps required to change the default JVM.

1) Edit /etc/jvm, and make sure the desired JVM is first on the list

2) sudo update-java-alternatives -s java-6-sun will update all the “jdk” binaries, or you can only point to specific tools like the java compiler (’javac’) like so update-alternatives –set javac /usr/lib/jvm/java6-sun/bin/javac

There, you should be all set. There might be cleaner ways of doing this — you could of course export JAVA_HOME and set that at the top of your $PATH list…

These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • del.icio.us
  • StumbleUpon
  • Technorati
  • Reddit