linux java home 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: finda java home
dirname $(dirname $(readlink -f $(which javac)))