Ask Different is a question and answer site for power users of Apple hardware and software. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am setting up Maven on my Mac but it is not working because the JAVA_HOME variable is not defined. I had expected the java installer to create this but alas not.

Where is java installed so I can create this variable myself?

share|improve this question
up vote 8 down vote accepted

George Garside's path is correct. Latest JDK released today from Oracle. I advise downloading directly from Oracle's Site. Use the symlink to create your JAVA_HOME variable. Add the following to your .bash_profile or .bashrc profile.

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

Just downloaded the kit and added the above to my .bash_profile. As you can see, variable is now clearly defined:

Macbook-Pro:~ njboot$ echo $JAVA_HOME


share|improve this answer
Thanks for answering – dmeehan Aug 20 '14 at 13:03
@dmeehan you're welcome. cheers. – njboot Aug 20 '14 at 16:11
share|improve this answer
Thanks for answering – dmeehan Aug 20 '14 at 13:04
It's not your time, is it? – Max Ried Aug 21 '14 at 16:32

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.