-
Notifications
You must be signed in to change notification settings - Fork 384
Trouble Shooting
After adding the following to your .bash_profile as per suggestion when installing jenv using brew.
# To enable shims and autocompletion add to your profile:
if which jenv > /dev/null; then eval "$(jenv init -)"; fi
# To use Homebrew's directories rather than ~/.jenv add to your profile:
export JENV_ROOT=/usr/local/opt/jenv
Then, when you tried to add a java version using jenv like so:
jenv add /Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home
You may receive the following error:
ln: /usr/local/opt/jenv/versions/oracle64-1.7.0.51: No such file or directory
The implication of installing jenv using brew seems to be that you need to use sudo in order to use jenv. So to solve the aforementioned issue, add sudo to the command like so:
sudo jenv add /Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home
This applies when using any jenv command. For example using jenv versions
gives the following output:
* system (set by /usr/local/opt/jenv/version)
However, after prefixing with sudo to the command e.g. sudo jenv versions
will give the correct results such as below:
* system (set by /Users/[your-username]/.jenv/version)
oracle64-1.6.0.65
oracle64-1.7.0.51
By adding the following to your .bash_profile, you will not have to use sudo when using jenv.
export JENV_ROOT=/usr/local/opt/jenv
If you still get the same error try this first:
$ jenv add /Library/Java/JavaVirtualMachines/jdk1.8.0_152.jdk/Contents/Home/
ln: /Users/user/.jenv/versions/oracle64-1.8.0.152: No such file or directory
# Try this to resolve:
$ mkdir -p /Users/user/.jenv/versions/oracle64-1.8.0.152
$ jenv add /Library/Java/JavaVirtualMachines/jdk1.8.0_152.jdk/Contents/Home/
# After this other java versions should no longer error out.
If, when running jenv doctor
, you see
[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.
make sure export JENV_ROOT=/usr/local/opt/jenv
appears before if which jenv > /dev/null; then eval "$(jenv init -)"; fi
in .bash_profile.
This is related to symlinks the next issue.
- Start by enabling symlinks issue below.
- After symlinks has been enabled. In Git Bash navigate to jenv location. Default is
~/.jenv
- Enable symlinks for the repository
git config core.symlinks true
- Do a new checkout of
bin/jenv
rungit checkout -- bin/jenv
Your problems should be solved.
Symlinks aren't working https://stackoverflow.com/a/40914277
It seems that it becomes a full copy instead of a symlink ~/.jenv/versions should have a size of 0, but without symlinks this grows fast since each alias is a full copy of the JVM.
- You need to run Git Bash as administrator (can be configure to always run as administrator under Properties -> Compatibility, make sure you know what this means).
- In Git Bash run
export MSYS=winsymlinks:nativestrict
this could be added to ~/.bash_profile