Beating my head on the wall with this. Using Mac 10.10 and my java -version works but mvn -version gives me
error: JAVA_HOME is not defined correctly. We cannot execute /Library/Java/JavaVirtualMachines/jdk1.8.0_05.jdk/Contents/Home/bin/java
and that's not even my correct jdk. Here is what my bash_profile looks like:export
export JAVA_HOME=/Library/Java/JavaVirtualMachine/jdk1.8.0_25.jdk/Contents/Home
export M2_HOME=/usr/local/apache-maven/apache-maven-3.2.3
export M2=$M2_HOME/bin
export MAVEN_OPTS=-Xms256m-Xmx512m
export PATH=$M2:$PATH