Sunday, November 9, 2008

Installing Sun Java 6.0 on Ubuntu

Ubuntu is defaultly deployed with GNU libgcj JVM which doesn't work with some applications, for example Eclipse. Also in my experience GNU libgcj JVM is much slower than Sun JRE.
Installing Sun Java 6 JRE is simple. Just issue the following command from shell:
apt-get install sun-java6-jre sun-java6-bin sun-java6-plugin sun-java6-jdk
You will need to be root or use "sudo" to perform this operation. You can skip package sun-java6-jdk if you dont plan on doing development in Java.

Once these packages are installed you can use Alternatives to make sun java your default JVM. To do this issue following command from shell:
update-alternatives --config java
You will get a screen like following:

The * sign means that this JVM is default. Enter the number for Sun JRE which in my case is 3. Now you can check your java version using: java -version

No comments: