Let us look at the steps to install Maven on Mac OS X. This applies to the latest version of Mac OS X, namely Yosemite.
Earlier, Apple provided Java for Mac, but stopped doing so from Java 7 onwards. Apple Java is not available on recent versions of Mac OS X.
Let us check if the Java environment is available on your Mac:
/usr/libexec/java_home -v 1.7
/usr/libexec/java_home -v 1.8