jenv: not setting a version on mac
# g.reshetniak @ MP24502 in ~/edge on git:master x [11:24:27]
$ jenv versions
system
* 1.7 (set by /Users/g.reshetniak/edge/.java-version)
1.7.0.181
1.8
1.8.0.181
openjdk64-1.7.0.181
oracle64-1.8.0.181
# g.reshetniak @ MP24502 in ~/edge on git:master x [11:24:33]
$ jenv global 1.7
# g.reshetniak @ MP24502 in ~/edge on git:master x [11:24:50]
$ java --version
java 10.0.2 2018-07-17
Java(TM) SE Runtime Environment 18.3 (build 10.0.2+13)
Java HotSpot(TM) 64-Bit Server VM 18.3 (build 10.0.2+13, mixed mode)
# g.reshetniak @ MP24502 in ~/edge on git:master x [11:24:53]
$ jenv local 1.7
# g.reshetniak @ MP24502 in ~/edge on git:master x [11:26:31]
$ java --version
java 10.0.2 2018-07-17
Java(TM) SE Runtime Environment 18.3 (build 10.0.2+13)
Java HotSpot(TM) 64-Bit Server VM 18.3 (build 10.0.2+13, mixed mode)
Seems like basic functionality, but it does not work as expected for me. What am I doing wrong?
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 34 (3 by maintainers)
Same issue. I used the following commands.
The outcome was not what I expected. Then~
I found a file named .java-version in the user’s directory. So I removed it. Then I got what I wanted~
I had the same problem, I could workaround it by enabling export plugin
Ok, that’s probably the problem.
zsh is using .zshrc and not .bashrc So jenv init is not called.
And restart you shell, and try again please
I’m having the same issue as @anton-fomin above. Any resolutions yet?
~ » jenv doctor
[OK] No JAVA_HOME set [OK] Java binaries in path are jenv shims [OK] Jenv is correctly loaded
ok !
Do you have this lines in your .zshrc/.bashrc:
After changing the version globally , and running java -version, the versions specified by jenv and the global java version differ. I fix it by using the command:
eval “$(jenv init -)” env enable-plugin export
Went into the same issue. Found that
jenv doctor
noticed about other java installation in $PATH which added by sdkman:In my case i don’t really need sdkman so i’ve decided to remove it (Remove lines with
sdkman
from your.zshrc
/.bashrc
/.bash_profile
, and thenrm -rf ~/.sdkman
)Putting all replies above together:
Check is following lines
eval "$(jenv init -)"
export PATH="$HOME/.jenv/bin:$PATH"
presented in your
.zshrc
/.bashrc
/.bash_profile
(check files in same order)Run
jenv doctor
and check for reported issuesMake sure that there is no any other java folder in your
$PATH
by runningecho $PATH | tr ":" "\n"
Try
jenv enable-plugin export
@anton-fomin I get
jenv: no such command
enable-plugin’` 😦