I tried the following:
Finding where java is installed:
$: whereisjava
$: java -version
$: echo $JAVA_HOME
$: echo $JDK_HOME
For Ubuntu, normally the openjdk version of Java is used.
Editing and saving ~/.bashrc
$: nano ~/.bashrc
JAVA_HOME = /usr/lib/jvm/java-7-openjdk-amd64/
export JAVA_HOME
JDK_HOME = /usr/lib/jvm/java-7-openjdk-amd64/
export JDK_HOME
Reloading ~/.bashrc
$: source ~/.bashrc
$: echo $JAVA_HOME
$: echo $JDK_HOME
Check for the correct version of Java if you are like me, having both Java 6 and 7 installed.
sudo update-alternatives --config java
Choose the correct version of Java.