Pages

Tuesday, September 21, 2010

Setting JAVA_HOME Environment variable in Ubuntu

I know this is a very tiny problem but we often tend to forget and start googling till we find an working example

We can use the following to set the $JAVA_HOME environment variable on an Ubuntu Linux system where there is no specific JDK installation directory and we want to point it to the default JDK location.This happens when JDK is installed from update manager.

export JAVA_HOME=/usr/lib/jvm/default-java

This entry can be made in the file ~/.bashrc to have it executed every time we log in and set the env variable automatically from the next log in onwards.