zl程序教程

您现在的位置是:首页 >  APP

当前栏目

brew安装jdk8 MAC M1

2023-04-18 14:26:28 时间

根据网上博客,命令行键入:

brew cast install adoptopenjdk8

结果报错:

Error: `brew cask` is no longer a `brew` command. Use `brew <command> --cask` instead.

意思是说原命令已经更新,采用新的命令形式替代:

brew install adoptopenjdk8 --cast
error: could not lock config file .git/config: Permission denied
error: could not lock config file .git/config: Permission denied
fatal: not in a git directory
Warning: No remote 'origin' in /opt/homebrew/Library/Taps/homebrew/homebrew-services, skipping update!
==> Caveats
Temurin is the official successor to this software:

  brew install --cask temurin8

adoptopenjdk8 has been officially discontinued upstream.
It may stop working correctly (or at all) in recent versions of macOS.

==> Downloading https://github.com/AdoptOpenJDK/openjdk8-binaries/releases/downl
==> Downloading from https://objects.githubusercontent.com/github-production-rel
######################################################################## 100.0%
==> Installing Cask adoptopenjdk8
==> Running installer for adoptopenjdk8; your password may be necessary.
Package installers may write to any location; options such as `--appdir` are ignored.
Password:

installer: Package name is AdoptOpenJDK
installer: Installing at base path /
installer: The install was successful.
🍺  adoptopenjdk8 was successfully installed!

安装成功,查看安装目录

/usr/libexec/java_home -V
Matching Java Virtual Machines (1):
    1.8.0_292 (x86_64) "AdoptOpenJDK" - "AdoptOpenJDK 8" /Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home

相关报错:

1、下载缓慢,建议科学下载

2、To retry an incomplete download, remove the file above.

Error: SHA256 mismatch
Expected: 4e200bc752337...6c8242a7672
  Actual: 441a61c9f3b9b6...0e1615427e
    File: /Users/xxx/Library/Caches/Homebrew/downloads/336d2dd4a6...dfcbf6--OpenJDK8U-jdk_x64_mac_hotspot_8u292b10.pkg
To retry an incomplete download, remove the file above.

原因:文件冲突,当前下载目录已经存在,删除后再重新下载
解决:根木Flile目录,找到对应的文件 删除,再重新执行下载

3、url: (92) HTTP/2 stream 1 was not closed cleanly before end of the underlying stream

原因:git默认使用的通信协议出现了问题,可以通过将默认通信协议修改为http/1.1来解决该问题。
解决:命令行执行 git config --global http.version HTTP/1.1,再重新执行下载

4、curl: (35) LibreSSL SSL_connect: SSL_ERROR_SYSCALL in connection to objects.githubusercontent.com:443

原因:因为柯学下载的原因,ip不匹配
解决:修改ip地址为自己proxy地址,将此处的6666改为自己的ip,再重新执行下载;
此处为临时修改,使当前窗口的所有命令都是柯学的。若关掉苛学,再重启终端即可

export https_proxy=http://127.0.0.1:6666 http_proxy=http://127.0.0.1:6666 all_proxy=socks5://127.0.0.1:6666