how to find java home in mac code example
Example 1: finda java home
dirname $(dirname $(readlink -f $(which javac)))
Example 2: find java home
/usr/libexec/java_home
dirname $(dirname $(readlink -f $(which javac)))
/usr/libexec/java_home