[英]Why the java version 8 which is selected in jenv is not in fact the current java on my Mac?
I have used brew to install sbt (which in its turn installs java 13), and brew cask to install openjdk java 8, like this:我已经使用 brew 安装 sbt (它反过来安装 java 13),并 brew cask 安装 openjdk java 13,如下所示:8,
brew install sbt
brew cask install adoptjava8
Then added the java 8 to jenv as seen below:然后将 java 8 添加到 jenv,如下所示:
jenv add (path to java 8 Home)
nicolae.marasoiu@OVO4939MB ~ % jenv versions
system
* 1.8 (set by /Users/nicolae.marasoiu/.java-version)
1.8.0.242
13.0
13.0.2
openjdk64-1.8.0.242
openjdk64-13.0.2
But still:但仍然:
nicolae.marasoiu@OVO4939MB ~ % java -version
openjdk version "13.0.2" 2020-01-14
OpenJDK Runtime Environment (build 13.0.2+8)
OpenJDK 64-Bit Server VM (build 13.0.2+8, mixed mode, sharing)
Solved it, with the information from https://github.com/Homebrew/homebrew-core/issues/31390使用来自https://github.com/Homebrew/homebrew-core/issues/31390的信息解决了它
Basically the steps are:基本上步骤是:
brew install jenv
echo 'eval "$(jenv init -)"' >> ~/.bash_profile
jenv add <path-to-java8-home>
So the missing part was the scripting part in.bash_profile or.zprofile that allows for jenv to configure the local shell to know about the wanted java version.所以缺少的部分是 .bash_profile 或 .zprofile 中的脚本部分,它允许 jenv 配置本地 shell 以了解想要的 java 版本。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.