I followed this thread to solve my problem, I have the same problem with a different version of JDK and for some reason it didn't work. I still get -bash: JAVA_HOME: command not found when I type JAVA_HOME to my terminal. I have JDK1.8.0.45 located at Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home which I can access with /usr/libexec/java_home
Using
echo "export JAVA_HOME=
/usr/libexec/java_home
" >> ~/.profile~/.profile
I do get "export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home" saved to ~/.profile, and I can check this using /usr/bin/open ~/.profile
But I do not understand why JAVA_HOME still doesn't work and I need this to install maven.
Thanks!