I have jenv installed. The output of which java
was initially /Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/bin/java
. I issues the following commands:
jenv add /Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home
eval "$(jenv init -)"
Now, the output of which java
is
/Users/my_username/.jenv/shims/java
The output of java -version
is the same before and after. However, mvn clean install
is throwing error:
Error: JAVA_HOME is not defined correctly.
We cannot execute /Users/my_username/.jenv/versions/system/bin/java
Why is maven not picking up the proper java?