为什么brew安装失败?

发布于 2025-01-10 05:43:40 字数 1808 浏览 0 评论 0原文

我使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

路还长,别太狂 2025-01-17 05:43:40

ln: /Library/Java/JavaVirtualMachines/openjdk-11.jdk: 没有这样的文件或目录

链接命令的目的是在指定目录中创建文件 openjdk-11.jdk。该错误表明该目录实际上并不存在。

尝试创建目录 /Library/Java/JavaVirtualMachines/ 并重新运行链接命令。

ln: /Library/Java/JavaVirtualMachines/openjdk-11.jdk: No such file or directory

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文