英文:
Why the java version 8 which is selected in jenv is not in fact the current java on my Mac?
问题
我已使用Homebrew安装了sbt(它又安装了Java 13),并使用brew cask安装了openjdk Java 8,操作如下:
brew install sbt
brew cask install adoptopenjdk8
然后将Java 8添加到jenv中,如下所示:
jenv add (Java 8的路径)
但仍然出现以下情况:
nicolae.marasoiu@OVO4939MB ~ % jenv versions
system
* 1.8 (由 /Users/nicolae.marasoiu/.java-version 设置)
1.8.0.242
13.0
13.0.2
openjdk64-1.8.0.242
openjdk64-13.0.2
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)
英文:
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 install sbt
brew cask install adoptjava8
Then added the java 8 to jenv as seen below:
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)
答案1
得分: 1
已解决,使用来自 https://github.com/Homebrew/homebrew-core/issues/31390 的信息。
基本步骤如下:
brew install jenv
echo 'eval "$(jenv init -)"' >> ~/.bash_profile
jenv add <path-to-java8-home>
所以缺失的部分是在 .bash_profile 或 .zprofile 中的脚本部分,允许 jenv 配置本地 shell 以了解所需的 Java 版本。
英文:
Solved it, with the information from 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.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论