执行命令brew install --cask adoptopenjdk/openjdk/adoptopenjdk8
安装jdk8报错,报错信息如下:
第一波报错
Cloning into '/usr/local/Homebrew/Library/Taps/adoptopenjdk/homebrew-openjdk'...
fatal: unable to access 'https://github.com/adoptopenjdk/homebrew-openjdk/': LibreSSL SSL_connect: SSL_ERROR_SYSCALL in connection to github.com:443
Error: Failure while executing; `git clone https://github.com/adoptopenjdk/homebrew-openjdk /usr/local/Homebrew/Library/Taps/adoptopenjdk/homebrew-openjdk --origin=origin --template=` exited with 128.
Appstore 搜索安装iHost
添加github节点,并添加如下映射
140.82.113.4 github.com
199.232.69.194 github.global.ssl.fastly.net
185.199.108.153 assets-cdn.github.com
185.199.109.153 assets-cdn.github.com
185.199.110.153 assets-cdn.github.com
185.199.111.153 assets-cdn.github.com
效果如下
打勾github相关映射
第二波报错
Updating Homebrew...
==> Downloading https://github.com/AdoptOpenJDK/openjdk8-binaries/releases/downl
==> Downloading from https://objects.githubusercontent.com/github-production-rel
############################################################ 83.6%
curl: (92) HTTP/2 stream 0 was not closed cleanly: PROTOCOL_ERROR (err 1)
Error: Download failed on Cask 'adoptopenjdk8' with message:
Download failed: https://github.com/AdoptOpenJDK/openjdk8-binaries/releases/download/jdk8u292-b10/OpenJDK8U-jdk_x64_mac_hotspot_8u292b10.pkg
重试多次依然不行
curl: (92) HTTP/2 stream 0 was not closed cleanly: PROTOCOL_ERROR (err 1)
这个是HTTP/2本身的bug,新版MacOS默认的HTTP连接使用的版本是2
如下重新设置成更稳定的HTTP/1.1版本
git config --global http.version HTTP/1.1
试过之后安装成功,如果怕衍生出其他问题,安装完成之后可以再设置回去(可以不管)
git config --global http.version HTTP/2
成功的画面如下
==> 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.
package-id: net.adoptopenjdk.8.jdk
version: 1.8.0_292-b10
volume: /
location:
install-time: 1642490140
🍺 adoptopenjdk8 was successfully installed!
relx@ZhanghaodeMacBook-Pro-2 RelxRNExplore % java -version
openjdk version "1.8.0_292"
OpenJDK Runtime Environment (AdoptOpenJDK)(build 1.8.0_292-b10)
OpenJDK 64-Bit Server VM (AdoptOpenJDK)(build 25.292-b10, mixed mode)