$ /usr/libexec/java_home
/Library/Java/JavaVirtualMachines/jdk1.8.0_192.jdk/Contents/Home
$ vi ~/.bash_profile
export JAVA_HOME=`/usr/libexec/java_home`
$ source ~/.bash_profile
$ echo $JAVA_HOME
$ /usr/libexec/java_home
/Library/Java/JavaVirtualMachines/jdk1.8.0_192.jdk/Contents/Home
$ vi ~/.bash_profile
export JAVA_HOME=`/usr/libexec/java_home`
$ source ~/.bash_profile
$ echo $JAVA_HOME