0

I am trying to get maven working on mac but it complains about not being able to locate $JAVA_HOME, so I set up the env variable in the following way

export JAVA_HOME = $(/Library/Java/JavaVirtualMachines/jdk1.8.0_31.jdk/Contents/Home)

I get maven working with this, but evey time I start a shell I get the following error

-bash: /Library/Java/JavaVirtualMachines/jdk1.8.0_31.jdk/Contents/Home: No such file or directory

Any thoughts?

user_mda
  • 18,148
  • 27
  • 82
  • 145

2 Answers2

0

Can you try the following export JAVA_HOME=/usr/libexec/java_home -v 1.8.0_73` ? Also see this What should I set JAVA_HOME to on OSX

p.s. - Adjust the commands for the java versions available on your machine

Community
  • 1
  • 1
Paras
  • 804
  • 1
  • 10
  • 25
0

In your question, the command shows spaces around the '=' sign in the assignment, which will mess it up.

The assignment should look like this:

export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_31.jdk/Contents/Home

You definitely shouldn't have the $(...) around it - that tries to execute the text inside the parentheses, which is why you get that "No such file or directory" error. Perhaps that came from trying to use examples which show how to execute the OSX java_home command, as shown in the answer to this question: What should I set JAVA_HOME to on OSX

Community
  • 1
  • 1
SusanW
  • 1,550
  • 1
  • 12
  • 22