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
e xport 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?
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
ps - Adjust the commands for the java versions available on your machine
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
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.