To find $JAVA_HOME on Ubuntu run:

echo $JAVA_HOME

If this yields nothing, you can set it with:

export JAVA_HOME=/usr/lib/jvm/java-8-oracle

Please note that your version of java might differ from java-8-oracle. In this case simple replace with the name of folder within /usr/lib/jvm