Set JAVA_HOME in Mac

Set JAVA_HOME in Mac

I just moved over to Mac (again) and the first thing when started Java Programming was how to get Java_Home in place. While Mac makes a lot of things easy, programming is where it takes you all back to the root. After much finding and reading I found that the following worked.


1. Start the Terminal application

2. Create or Edit a file with the name.location “~/.bash_profile file”. Do    $ vi ~/.bash_profile

3. Put the following line in the file (if it is broken down to  2 lines put it in a single line)

export JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home

4. Save the file.

5. Restart the Terminal and then try $ echo $JAVA_HOME


And you are all set

3 Comments on "Set JAVA_HOME in Mac"

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: