Dynamically set path to JAVA_HOME

Last modified: 
Friday, October 7th, 2016
Topics: 
JavaOSX

How to dynamically set the path to JAVA_HOME in OS X.

Add the following to ~/.bash_profile:

export JAVA_HOME=$(/usr/libexec/java_home)

Reload your bash_profile.

source ~/.bash_profile


The operator of this site makes no claims, promises, or guarantees of the accuracy, completeness, originality, uniqueness, or even general adequacy of the contents herein and expressly disclaims liability for errors and omissions in the contents of this website.