Thursday, August 23, 2007

Install Sun Java on Ubuntu 7.04

The installation of Java is quite easy. The default installation has the GNU version of Java, to run Sun engine first install the following packages:

sudo apt-get install sun-java6-jre sun-java6-plugin sun-java6-fonts

Then check the version of Java running, the GNU version should still be the default one:

ricardo@lmnwok1:~$ java -version
java version "1.4.2"
gij (GNU libgcj) version 4.1.2 (Ubuntu 4.1.2-0ubuntu5)

Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
ricardo@lmnwok1:~$

To select the new Sun engine run the update-alternatives as below and select the option you want to use:

ricardo@lmnwok1:~$ sudo update-alternatives --config java

There are 3 alternatives which provide `java'.

Selection Alternative
-----------------------------------------------
1 /usr/bin/gij-wrapper-4.1
2 /usr/lib/jvm/java-6-sun/jre/bin/java
*+ 3 /usr/lib/jvm/java-gcj/jre/bin/java

Press enter to keep the default[*], or type selection number: 2
Using `/usr/lib/jvm/java-6-sun/jre/bin/java' to provide `java'.
ricardo@lmnwok1:~$


Now when checking the version you will see the new one:

ricardo@lmnwok1:~$ java -version
java version "1.6.0"
Java(TM) SE Runtime Environment (build 1.6.0-b105)
Java HotSpot(TM) Client VM (build 1.6.0-b105, mixed mode, sharing)
ricardo@lmnwok1:~$



After this as in my other post change the JRE used by Eclipse.

No comments: