set java_home variable linux code example
Example 1: export java home
export JAVA_HOME_BIN=`which java`
export JAVA_HOME_DIR=`dirname $JAVA_HOME_BIN`
export JAVA_HOME=`dirname $JAVA_HOME_DIR`
Example 2: set $JAVA_HOME variable in ubuntu
export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64