I have installed java7 through brew cask install java7
then run the command
jenv add /Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home/
I have also installed java8 through brew cask install java
then run the command
jenv add /Library/Java/JavaVirtualMachines/jdk1.8.0_66.jdk/Contents/Home/
the error is like this one
/System/Library/Java/JavaVirtualMachines/jdk1.7.0_71.jdk/Contents/Home is not a valid path to java installation
can you
jenv doctor
?
Yes.
Do you have if which jenv > /dev/null; then eval "$(jenv init -)"; fi
in your shell profile ?
Hi guys. Same as the above, I installed java10 through brew cask install java
Then run the command:
jenv add /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java
/System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java is not a valid path to java installation
jenv doctor
[OK] No JAVA_HOME set
[ERROR] Java binary in path is not in the jenv shims.
[ERROR] Please check your path, or try using /path/to/java/home is not a valid path to java installation.
PATH : /usr/local/Cellar/jenv/0.4.4/libexec/libexec:/Users/pyousefi/.jenv/shims:/Users/pyousefi/.jenv/bin:/anaconda3/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
[OK] Jenv is correctly loaded
I located the different installation directory for java:
/Library/Java/JavaVirtualMachines/
And have:
jdk-10.0.1.jdk jdk1.8.0_172.jdk
I cannot add either of the locations where the java executable is located to jenv.
I fixed it by:
export JENV_ROOT=/usr/local/opt/jenv
sudo jenv add /Library/Java/JavaVirtualMachines/jdk-10.0.1.jdk/Contents/Home/
sudo jenv add /Library/Java/JavaVirtualMachines/jdk1.8.0_172.jdk/Contents/Home/
but now jenv versions does not provide what I want and I must:
sudo jenv versions
or just do this:
http://davidcai.github.io/blog/posts/install-multiple-jdk-on-mac/
I was getting this error and got passed it by creating the .jenv folder in ~ after that worked like a charm
Had same issue but was able to fix it by restarting terminal. As shown:
Restart your shell by closing and reopening your terminal window or running exec $SHELL -l in the current session for the changes to take effect.
To verify jenv was installed, run jenv doctor. On a macOS machine, you'll observe the following output:
$ jenv doctor
[OK] No JAVA_HOME set
[ERROR] Java binary in path is not in the jenv shims.
[ERROR] Please check your path, or try using /path/to/java/home is not a valid path to java installation.
PATH : /Users/user/.jenv/libexec:/Users/user/.jenv/shims:/Users/user/.jenv/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
[OK] Jenv is correctly loaded
similar issue at zsh shell:
ls /Library/Java/JavaVirtualMachines
adoptopenjdk-8.jdk
jdk-14.0.2.jdk
jenv add /Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home
ln: /usr/local/opt/jenv/versions/openjdk64-1.8.0.265: No such file or directory
jenv doctor
[OK] No JAVA_HOME set
[ERROR] Java binary in path is not in the jenv shims.
[ERROR] Please check your path, or try using /path/to/java/home is not a valid path to java installation.
PATH : /usr/local/Cellar/jenv/0.5.4/libexec/libexec:/Users/webia1/.jenv/shims:/Users/webia1/.nvm/versions/node/v8.17.0/bin:/Users/webia1/.cargo/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin
[OK] Jenv is correctly loaded
The following configuration (~/.zshrc
) has helped:
eval export PATH="/Users/__YOUR_USER_NAME__/.jenv/shims:${PATH}"
export JENV_SHELL=zsh
export JENV_LOADED=1
unset JAVA_HOME
source '/usr/local/Cellar/jenv/0.5.4/libexec/libexec/../completions/jenv.zsh'
jenv rehash 2>/dev/null
jenv refresh-plugins
jenv() {
typeset command
command="$1"
if [ "$#" -gt 0 ]; then
shift
fi
case "$command" in
enable-plugin|rehash|shell|shell-options)
eval `jenv "sh-$command" "$@"`;;
*)
command jenv "$command" "$@";;
esac
}
Most helpful comment
I fixed it by:
export JENV_ROOT=/usr/local/opt/jenv
sudo jenv add /Library/Java/JavaVirtualMachines/jdk-10.0.1.jdk/Contents/Home/
sudo jenv add /Library/Java/JavaVirtualMachines/jdk1.8.0_172.jdk/Contents/Home/
but now jenv versions does not provide what I want and I must:
sudo jenv versions