0

I am trying to install Maven on a Mac following the instructions here;

http://maven.apache.org/download.cgi#Installation_Instructions.

However I couldn't figure out how to

Make sure that JAVA_HOME is set to the location of your JDK, e.g. export JAVA_HOME=/usr/java/jdk1.7.0_51 and that $JAVA_HOME/bin is in your PATH environment variable.

My Java JDK is stored on desktop, so should I use the command?

export JAVA_HOME=/users/alex/desktop/jdk1.7.0_45

After I've done that, should the JAVA_HOME/bin be in my path environment variable?

It did work. The error message when I run maven --version says

Error: JAVA_HOME is not defined correctly. We cannot execute /users/alex/desktop/jdk1.7.0_45/bin/java

I am quite confused with the whole process. Many thanks for your help in advance. Really appreciate it.

Semih Eker
  • 2,389
  • 1
  • 20
  • 29
  • I also tried "/usr/libexec/java_home -v 1.7" to get the path "/Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/Contents/Home", which is supposed to be where Java is installed? and then use " export JAVA_HOME=Library/Java/JavaVirtualMachines/jdk1.7.0_45 " to set up Maven but it still doesn't work.. – stillAFanOfTheSimpsons Dec 17 '14 at 03:03

1 Answers1

0

The issue with your steps are these environment variables are not permanent in the system, paths will only be set to the current terminal. You should set this globally. To do this refer to this answer or this

Community
  • 1
  • 1
Shenal
  • 202
  • 5
  • 21