java 弹出错误:“openjdk-11.0.2已损坏,无法打开”在mac os ventura上

5uzkadbs  于 2023-02-21  发布在  Java
关注(0)|答案(3)|浏览(525)

jdk 11在我的mac os莫哈韦上很好。在升级到Mac OS Ventura时,我开始看到这个弹出错误:

openjdk-11.0.2已损坏,无法打开。我使用brew卸载并重新安装openjdk 11,但仍然得到相同的错误:

$ brew uninstall openjdk@11
Uninstalling /usr/local/Cellar/openjdk@11/11.0.16.1_1... (678 files, 298.8MB)

$ /usr/libexec/java_home -V
Matching Java Virtual Machines (2):
    1.8.261.12 (x86_64) "Oracle Corporation" - "Java" /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home
    1.8.0_191 (x86_64) "Oracle Corporation" - "Java SE 8" /Library/Java/JavaVirtualMachines/jdk1.8.0_191.jdk/Contents/Home
/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home

$ brew install openjdk@11
==> Downloading https://ghcr.io/v2/homebrew/core/openjdk/11/manifests/11.0.16.1_1
Already downloaded: /Users/user/Library/Caches/Homebrew/downloads/66d77b9adc57a7f85fca1b4c90e6187f64aa336a0777d7dc1014151d925df3d8--openjdk@11-11.0.16.1_1.bottle_manifest.json
==> Downloading https://ghcr.io/v2/homebrew/core/openjdk/11/blobs/sha256:4157114f6dd128b93d0732559787f191678d2d496476e19855a03d0f226aa50c
Already downloaded: /Users/user/Library/Caches/Homebrew/downloads/853c10b19f8f8cd779b49261c60a74abf52e9fea1067d934c45549bea2b8ed3e--openjdk@11--11.0.16.1_1.ventura.bottle.tar.gz
==> Pouring openjdk@11--11.0.16.1_1.ventura.bottle.tar.gz

==> Caveats
For the system Java wrappers to find this JDK, symlink it with
  sudo ln -sfn /usr/local/opt/openjdk@11/libexec/openjdk.jdk /Library/Java/JavaVirtualMachines/openjdk-11.jdk

openjdk@11 is keg-only, which means it was not symlinked into /usr/local,
because this is an alternate version of another formula.

If you need to have openjdk@11 first in your PATH, run:
  echo 'export PATH="/usr/local/opt/openjdk@11/bin:$PATH"' >> /Users/user/.bash_profile

For compilers to find openjdk@11 you may need to set:
  export CPPFLAGS="-I/usr/local/opt/openjdk@11/include"

==> Summary
�  /usr/local/Cellar/openjdk@11/11.0.16.1_1: 678 files, 298.8MB
==> 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`).
nwwlzxa7

nwwlzxa71#

我用rm删除了所有openjdk 11目录

/Library/Java/JavaVirtualMachines/

&

/usr/local/Cellar/

并使用以下命令重新安装openjdk11:

brew install openjdk@11

现在,没有更多的弹出错误。

lb3vh1jj

lb3vh1jj2#

重新安装总是你最好的选择。我以前也遇到过几次这样的问题。

5t7ly7z5

5t7ly7z53#

对于最新的MacOS版本(我相信是 Catalina 和更新版本),关键是以下命令(注意,您可能需要根据自己的JDK风格调整路径-此路径用于GraalVM):

xattr -r -d com.apple.quarantine /Library/Java/JavaVirtualMachines/graalvm-ce-javaV-XX.Y.Z

它在graalvm/homebrew-tap install instructions上的轮廓很好。

相关问题