Fixing JAVA_HOME is not set error on Ubuntu

After installing Apache Pig, you can run it with the command pig, but you might get this error:

$ pig
Error: JAVA_HOME is not set.

The solution is to set an environmental variable JAVA_HOME to the location of your java installation.

On my version of ubuntu this is done with:

export JAVA_HOME=/usr/lib/jvm/java-6-openjdk/jre/

After that, pig loads fine.

This entry is tagged: