Here’s what needs to be done:
– Start the Terminal.
$ vi ~/.bash_profile
… and paste the following (make it a single line):
this set to java 1.6 or default installed in your mac.
But if you download and install jdk 1.7 which is pointing to /usr/bin/java
echo $JAVA_HOME to check the java version
Maven uses JAVA_HOME value for java .
Note: I also tried creating and using the ~/.bashrc file, but that didn’t work (Mac OS 10.6.2), while ~/.bash_profile worked as expected.