1. download and install java 8.
2. download and extract maven
3. create a .bash_profile under ~ (Users/yourname) if you do not have such a file (use ls -a to view all files including hidden ones). This file contains the options when you start your terminal.
4. find your java_home first:
Java 7 and Java 8 are installed under
/Library/Java/JavaVirtualMachines, and to get informations about the installed Java VM’s you can use the /usr/libexec/java_home command, which is a link/shortcut to
Some of the command to use are:
/usr/libexec/java_home -verbose will give you all installed versions with path.
/usr/libexec/java_home -v '1.6*' will give you JAVA_HOME of Java 6
/usr/libexec/java_home -v '1.7*' will give you JAVA_HOME of Java 7 (if installed)
/usr/libexec/java_home -v '1.8*' will give you JAVA_HOME of Java 8 (if installed)
/usr/libexec/java_home is called without any parameters you should get the current enabled (newest) Java version. If you don’t get the newest Java version when
/usr/libexec/java_home is called, you can try a restart of your Mac, so that the system reload its current load of the
/usr/bin/java link/shortcut to
5. add following lines to the .bash_profile
6. now run java -version and mvn –version to check the installation.