Reputation: 1243
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?
Upvotes: 4
Views: 15239
Reputation: 1243
jenv versions
showed the current version was system. I am not sure why that version was not proper. I set the global version to 1.8.0.121
and everything is working as expected.
Upvotes: 0
Reputation: 20455
According to documentation eval "$(jenv init -)"
should print to console some command which you need to execute (they suggest to add them to .bash_profile).
Upvotes: 12