为什么brew安装失败?
我使用 Home Brew 安装了 java11 但失败了。因此需要一些帮助才能让 Java 正常工作!
感谢您的提前!
admin@mac ~ % brew install java11
Warning: openjdk@11 11.0.12 is already installed and up-to-date.
To reinstall 11.0.12, run:
brew reinstall openjdk@11
然后在重新安装后brew重新安装java11
admin@mac ~ % brew reinstall java11
==> Downloading https://ghcr.io/v2/homebrew/core/openjdk/11/manifests/11.0.12
Already downloaded: /Users/admin/Library/Caches/Homebrew/downloads/45acc78f00cc0cf39a75f562f544fd9b61dc415df386dd1cb9b886c1f553252d--openjdk@11-11.0.12.bottle_manifest.json
==> Downloading https://ghcr.io/v2/homebrew/core/openjdk/11/blobs/sha256:dbf0b347060474c1aa0fbe3e58e33f4d81337e6f49209761da130ee776d66355
Already downloaded: /Users/admin/Library/Caches/Homebrew/downloads/f08afa8f068cb282e649564e38b9fbe4aafc8e7f0d7b969fa17651c6df2f14e5--openjdk@11--11.0.12.arm64_big_sur.bottle.tar.gz
==> Reinstalling openjdk@11
==> Pouring [email protected]_big_sur.bottle.tar.gz
==> Caveats
For the system Java wrappers to find this JDK, symlink it with
sudo ln -sfn /opt/homebrew/opt/openjdk@11/libexec/openjdk.jdk /Library/Java/JavaVirtualMachines/openjdk-11.jdk
openjdk@11 is keg-only, which means it was not symlinked into /opt/homebrew,
because this is an alternate version of another formula.
If you need to have openjdk@11 first in your PATH, run:
echo 'export PATH="/opt/homebrew/opt/openjdk@11/bin:$PATH"' >> ~/.zshrc
For compilers to find openjdk@11 you may need to set:
export CPPFLAGS="-I/opt/homebrew/opt/openjdk@11/include"
==> Summary
I installed java11 using Home Brew but that failed. So some help needed to get Java works!
Thanks for advance!
admin@mac ~ % brew install java11
Warning: openjdk@11 11.0.12 is already installed and up-to-date.
To reinstall 11.0.12, run:
brew reinstall openjdk@11
Then brew reinstall java11
admin@mac ~ % brew reinstall java11
==> Downloading https://ghcr.io/v2/homebrew/core/openjdk/11/manifests/11.0.12
Already downloaded: /Users/admin/Library/Caches/Homebrew/downloads/45acc78f00cc0cf39a75f562f544fd9b61dc415df386dd1cb9b886c1f553252d--openjdk@11-11.0.12.bottle_manifest.json
==> Downloading https://ghcr.io/v2/homebrew/core/openjdk/11/blobs/sha256:dbf0b347060474c1aa0fbe3e58e33f4d81337e6f49209761da130ee776d66355
Already downloaded: /Users/admin/Library/Caches/Homebrew/downloads/f08afa8f068cb282e649564e38b9fbe4aafc8e7f0d7b969fa17651c6df2f14e5--openjdk@11--11.0.12.arm64_big_sur.bottle.tar.gz
==> Reinstalling openjdk@11
==> Pouring [email protected]_big_sur.bottle.tar.gz
==> Caveats
For the system Java wrappers to find this JDK, symlink it with
sudo ln -sfn /opt/homebrew/opt/openjdk@11/libexec/openjdk.jdk /Library/Java/JavaVirtualMachines/openjdk-11.jdk
openjdk@11 is keg-only, which means it was not symlinked into /opt/homebrew,
because this is an alternate version of another formula.
If you need to have openjdk@11 first in your PATH, run:
echo 'export PATH="/opt/homebrew/opt/openjdk@11/bin:$PATH"' >> ~/.zshrc
For compilers to find openjdk@11 you may need to set:
export CPPFLAGS="-I/opt/homebrew/opt/openjdk@11/include"
==> Summary
???? /opt/homebrew/Cellar/openjdk@11/11.0.12: 670 files, 273.0MB
==> Running `brew cleanup openjdk@11`...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).
After reinstall:
admin@mac ~ % echo 'export PATH="/opt/homebrew/opt/openjdk@11/bin:$PATH"' >> ~/.zshrc
And test java -version
admin@mac ~ % java -version
The operation couldn’t be completed. Unable to locate a Java Runtime.
Please visit http://www.java.com for information on installing Java.
Also:
admin@mac ~ % sudo ln -sfn /opt/homebrew/opt/openjdk@11/libexec/openjdk.jdk /Library/Java/JavaVirtualMachines/openjdk-11.jdk
Password:
ln: /Library/Java/JavaVirtualMachines/openjdk-11.jdk: No such file or directory
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
链接命令的目的是在指定目录中创建文件
openjdk-11.jdk
。该错误表明该目录实际上并不存在。尝试创建目录
/Library/Java/JavaVirtualMachines/
并重新运行链接命令。The purpose of the linking command is to create the file
openjdk-11.jdk
in the stated directory. The error suggests that this directory doesn't actually exist.Try creating the directory
/Library/Java/JavaVirtualMachines/
and rerunning the linking command.