Monday, November 23, 2009

Set JAVA_HOME and PATH on ubuntu 9.10

Instead of installing JDK from synaptic package manager, you can manually download JDK 6 Update 17 from http://java.sun.com/javase/downloads/index.jsp. After downloading "jdk-6u17-linux-i586.bin", make it executable by changing its mode and run to install by issuing following commands.

$ chmod 777 jdk-6u17-linux-i586.bin
$ ./java_ee_sdk-5_08-jdk-6u17-linux.bin

After that point edit your /etc/profile file to add lines below:
$ sudo gedit /etc/profile

PATH=(yourJDKInstallationFolder)/bin:${PATH}
export PATH
JAVA_HOME=(yourJDKInstallationFolder)
export JAVA_HOME

Save /etc/profile and logout. To test your JAVA_HOME location and installed java version type from the console:
$ java -version

$ echo $JAVA_HOME