Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jenv add not a valid path to java installation #139

Open
HeIsIdeus opened this issue Mar 12, 2016 · 12 comments
Open

jenv add not a valid path to java installation #139

HeIsIdeus opened this issue Mar 12, 2016 · 12 comments

Comments

@HeIsIdeus
Copy link

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

screen shot 2016-03-12 at 2 55 33 pm

@gcuisinier
Copy link
Collaborator

can you

jenv doctor ?

@HeIsIdeus
Copy link
Author

Yes.
screen shot 2016-03-14 at 8 43 45 am

@gcuisinier
Copy link
Collaborator

Do you have if which jenv > /dev/null; then eval "$(jenv init -)"; fi in your shell profile ?

@pyousefi
Copy link

pyousefi commented May 25, 2018

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.

@pyousefi
Copy link

pyousefi commented May 25, 2018

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

@MagdalenaZZ
Copy link

or just do this:
http://davidcai.github.io/blog/posts/install-multiple-jdk-on-mac/

@daliclass
Copy link

I was getting this error and got passed it by creating the .jenv folder in ~ after that worked like a charm

@akojimsg
Copy link

akojimsg commented Jul 28, 2020

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

@webia1
Copy link

webia1 commented Sep 12, 2020

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
}

@Ljqiii
Copy link

Ljqiii commented Nov 21, 2021

run this command to make zsh load zsh shims first.

export PATH="$HOME/.jenv/shims:$PATH"

@tianshuainan
Copy link

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

thanks very much

@shicky4
Copy link

shicky4 commented Apr 28, 2022

Yes. screen shot 2016-03-14 at 8 43 45 am

my file is exactly the same as yours and I'm still experiencing this issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants