jenv: jenv add "ln No such file or directory"
MacOS 10.12.4
I used Homebrew to install java with
brew update
brew cast install java
and I checked the version of it as following.
xxxx-MacBook-Pro:Home reapor.yurnero$ java -version
java version "1.8.0_121"
Java(TM) SE Runtime Environment (build 1.8.0_121-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.121-b13, mixed mode)
Then I tried jenv add
jenv add /Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home
but it shows
ln: /Users/reapor.yurnero/.jenv/versions/oracle64-1.8.0.121: No such file or directory
So I’m confused which procedure am I wrong.
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 77
- Comments: 21
Do you have add eval
$(jenv init -)
in you shell init (bashrc, zshrc) ? And close/reopen a shell ?I am running into the same error. The issue is that there is no
~/.jenv/versions
folder. As a workaround, I added the folder structure, and thenjenv add
works fine after that.Confirming this issue. Approriate line is added to profile but
jenv doctor
states not running in shell even after restart.mkdir ~/.jenv/versions
resolves.Ah, yes, it should be like so in my
.bashrc
:Then doing
jenv add
works!Had the same Issue.
mkdir -p ~/.jenv/versions
did the trick. I’m using zsh and didn’t need to add some PATH.Best Regards
I was getting a similar issue-- after attempting to add java 11 with jenv and use it, I would get an error like:
The other solutions posted here were not sufficient for my issue. It could be reproduced by just typing
java --version
in the terminal.How I solved it:
When I looked in
/usr/local/Cellar/jenv/
, I found that there was indeed no directory0.5.4
, but there was one titled0.5.5_2
. I opened up/Users/charlie/.jenv/shims/java
with a text editor, replaced0.5.4
with0.5.5_2
, and the problem was solved. I am now able to use java 11.Hope this helps in case anyone else runs into the same thing.
I meat the same problem. And I have solved it. Here is the website of Jenv. After you installed the Jenv, you need to init the
$(jenv init -)
. How to init it has written at website. As for me, I use macOS with zsh. So I init that with the following commands:$ echo 'export PATH="$HOME/.jenv/bin:$PATH"' >> ~/.zshrc
$ echo 'eval "$(jenv init -)"' >> ~/.zshrc
After initiation, restart your zsh/shell or open a new window of zsh/shell. Now you can add java successfully.On
OSX Big Sur v11.2.3
I have had to> mkdir ~/.jenv
then> mkdir ~/.jenv/versions
as neither directory had been created.Same error happened to me after upgrading from 0.5.5_2 to 0.5.6 with brew. I fixed it by manually editing the path in
~/.jenv/shims/java
.Just had the issue with the directory structure, 2022, had to
mkdir ~/.jenv/versions
I guess I missed these:Thanks, this fixed it for me too, it originated after running
brew upgrade
to update everything@Dshosev this trick mkdir -p ~/.jenv/versions worked for me on Fedora Linux as well with bash.
this worked for me
Actually, I run into the same issue and the solution by @jschavey is not working. I’ve added the initiation lines to my
.bashrc
file:This throws this error:
Checking out the directory shows this:
Hence, since we installed
jenv
viabrew
things are stored there. I suspect the re-direct should be to that folder or am I wrong?For me adding
JENV_ROOT=/usr/local/opt/jenv
into ~/.zshrc fixed the issueThis worked perfectly. Thank you.