find JAVA_HOME code example
Example 1: finda java home
dirname $(dirname $(readlink -f $(which javac)))
Example 2: find where JAVA_HOME is set
grep JAVA_HOME /etc/environment /etc/bash.bashrc /etc/profile.d/* /etc/profile
Example 3: find java home
/usr/libexec/java_home