首先,搜索可用的java版本:
[root@izbp19pke6x0v6ruecuy1yz ~]# sdk list java
================================================================================
Available Java Versions
================================================================================
Vendor | Use | Version | Dist | Status | Identifier
--------------------------------------------------------------------------------
AdoptOpenJDK | | 16.0.1.j9 | adpt | | 16.0.1.j9-adpt
| | 16.0.1.hs | adpt | | 16.0.1.hs-adpt
| | 11.0.11.j9 | adpt | | 11.0.11.j9-adpt
| | 11.0.11.hs | adpt | | 11.0.11.hs-adpt
| | 8.0.292.j9 | adpt | | 8.0.292.j9-adpt
| | 8.0.292.hs | adpt | | 8.0.292.hs-adpt
Alibaba | | 11.0.9.4 | albba | | 11.0.9.4-albba
| | 8.5.5 | albba | | 8.5.5-albba
Amazon | | 16.0.1.9.1 | amzn | | 16.0.1.9.1-amzn
| | 11.0.11.9.1 | amzn | | 11.0.11.9.1-amzn
| | 8.292.10.1 | amzn | | 8.292.10.1-amzn
Azul Zulu | | 16.0.1 | zulu | | 16.0.1-zulu
| | 16.0.1.fx | zulu | | 16.0.1.fx-zulu
| | 11.0.11 | zulu | | 11.0.11-zulu
| | 11.0.11.fx | zulu | | 11.0.11.fx-zulu
| | 8.0.292 | zulu | | 8.0.292-zulu
| | 8.0.292.fx | zulu | | 8.0.292.fx-zulu
| | 7.0.302 | zulu | | 7.0.302-zulu
| | 6.0.119 | zulu | | 6.0.119-zulu
BellSoft | | 16.0.1.fx | librca | | 16.0.1.fx-librca
| | 16.0.1 | librca | | 16.0.1-librca
| | 11.0.11.fx | librca | | 11.0.11.fx-librca
| | 11.0.11 | librca | | 11.0.11-librca
| | 8.0.292.fx | librca | | 8.0.292.fx-librca
| | 8.0.292 | librca | | 8.0.292-librca
GraalVM | | 21.1.0.r16 | grl | | 21.1.0.r16-grl
| | 21.1.0.r11 | grl | | 21.1.0.r11-grl
| | 21.1.0.r8 | grl | | 21.1.0.r8-grl
| | 21.0.0.2.r11 | grl | | 21.0.0.2.r11-grl
| | 21.0.0.2.r8 | grl | | 21.0.0.2.r8-grl
| | 20.3.2.r11 | grl | | 20.3.2.r11-grl
| | 20.3.2.r8 | grl | | 20.3.2.r8-grl
| | 20.3.1.2.r11 | grl | | 20.3.1.2.r11-grl
| | 20.3.1.2.r8 | grl | | 20.3.1.2.r8-grl
| | 19.3.6.r11 | grl | | 19.3.6.r11-grl
| | 19.3.6.r8 | grl | | 19.3.6.r8-grl
| | 19.3.5.r11 | grl | | 19.3.5.r11-grl
| | 19.3.5.r8 | grl | | 19.3.5.r8-grl
Java.net | | 18.ea.4 | open | | 18.ea.4-open
| | 18.ea.3 | open | | 18.ea.3-open
| | 18.ea.2 | open | | 18.ea.2-open
| | 18.ea.1 | open | | 18.ea.1-open
| | 17.ea.29 | open | | 17.ea.29-open
| | 17.ea.28 | open | | 17.ea.28-open
| | 17.ea.27 | open | | 17.ea.27-open
| | 17.ea.26 | open | | 17.ea.26-open
| | 17.ea.25 | open | | 17.ea.25-open
| | 17.ea.7.lm | open | | 17.ea.7.lm-open
| | 17.ea.3.pma | open | | 17.ea.3.pma-open
| | 16.0.1 | open | | 16.0.1-open
| | 11.0.11 | open | | 11.0.11-open
| | 11.0.10 | open | | 11.0.10-open
| | 11.0.2 | open | | 11.0.2-open
| | 8.0.292 | open | | 8.0.292-open
| | 8.0.282 | open | | 8.0.282-open
| | 8.0.265 | open | | 8.0.265-open
Mandrel | | 21.1.0.0 | mandrel | | 21.1.0.0-mandrel
| | 20.3.2.0 | mandrel | | 20.3.2.0-mandrel
Microsoft | | 16.0.1.9.1 | ms | | 16.0.1.9.1-ms
| | 11.0.11.9.1 | ms | | 11.0.11.9.1-ms
SAP | | 16.0.1 | sapmchn | | 16.0.1-sapmchn
| | 11.0.11 | sapmchn | | 11.0.11-sapmchn
TravaOpenJDK | | 11.0.9 | trava | | 11.0.9-trava
| | 8.0.232 | trava | | 8.0.232-trava
================================================================================
Use the Identifier for installation:
$ sdk install java 11.0.3.hs-adpt
================================================================================
当我使用时sdkman安装jdk,出现这个错误:
[root@izbp19pke6x0v6ruecuy1yz ~]# sdk install java 11.0.11.hs-adpt
Downloading: java 11.0.11.hs-adpt
In progress...
######################################################################## 100.0%
curl: (35) Encountered end of file
Download has failed, aborting!
Can not install java 11.0.11.hs-adpt at this time...
我应该做什么来修复它?这是我的 sdkman 版本:
[root@izbp19pke6x0v6ruecuy1yz ~]# sdk version
SDKMAN 5.11.6
现在我启用了debbug模式,似乎无法访问github.com:
[root@izbp19pke6x0v6ruecuy1yz etc]# sdk install java 11.0.11.hs-adpt
Validate java 11.0.11.hs-adpt for linuxx64: valid
Validation URL: https://api.sdkman.io/2/candidates/validate/java/11.0.11.hs-adpt/linuxx64
Get pre-installation hook: https://api.sdkman.io/2/hooks/pre/java/11.0.11.hs-adpt/linuxx64
Copy remote pre-installation hook: /root/.sdkman/tmp/hook_pre_java_11.0.11.hs-adpt.sh
No Linux pre-install hook found for Java 11.0.11.hs-adpt.
Completed pre-installation hook...
Downloading: java 11.0.11.hs-adpt
In progress...
######################################################################## 100.0%* About to connect() to api.sdkman.io port 443 (#0)
* Trying 45.55.42.78...
* Connected to api.sdkman.io (45.55.42.78) port 443 (#0)
* Initializing NSS with certpath: sql:/etc/pki/nssdb
* CAfile: /etc/pki/tls/certs/ca-bundle.crt
CApath: none
* SSL connection using TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
* Server certificate:
* subject: CN=*.sdkman.io
* start date: May 30 00:00:00 2020 GMT
* expire date: Apr 28 23:59:59 2022 GMT
* common name: *.sdkman.io
* issuer: CN=Sectigo RSA Domain Validation Secure Server CA,O=Sectigo Limited,L=Salford,ST=Greater Manchester,C=GB
> GET /2/broker/download/java/11.0.11.hs-adpt/linuxx64 HTTP/1.1
> Range: bytes=192792051-
> User-Agent: curl/7.29.0
> Host: api.sdkman.io
> Accept: */*
>
< HTTP/1.1 302 Found
< Server: nginx/1.19.1
< Date: Fri, 02 Jul 2021 17:48:27 GMT
< Content-Length: 0
< Connection: keep-alive
< location: https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-11.0.11%2B9/OpenJDK11U-jdk_x64_linux_hotspot_11.0.11_9.tar.gz
<
* Connection #0 to host api.sdkman.io left intact
* Issue another request to this URL: 'https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-11.0.11%2B9/OpenJDK11U-jdk_x64_linux_hotspot_11.0.11_9.tar.gz'
* About to connect() to github.com port 443 (#1)
* Trying 13.229.188.59...
* Connected to github.com (13.229.188.59) port 443 (#1)
* CAfile: /etc/pki/tls/certs/ca-bundle.crt
CApath: none
* SSL connection using TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256
* Server certificate:
* subject: CN=github.com,O="GitHub, Inc.",L=San Francisco,ST=California,C=US
* start date: Mar 25 00:00:00 2021 GMT
* expire date: Mar 30 23:59:59 2022 GMT
* common name: github.com
* issuer: CN=DigiCert High Assurance TLS Hybrid ECC SHA256 2020 CA1,O="DigiCert, Inc.",C=US
> GET /AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-11.0.11%2B9/OpenJDK11U-jdk_x64_linux_hotspot_11.0.11_9.tar.gz HTTP/1.1
> Range: bytes=192792051-
> User-Agent: curl/7.29.0
> Host: github.com
> Accept: */*
>
< HTTP/1.1 302 Found
< Server: GitHub.com
< Date: Fri, 02 Jul 2021 17:48:28 GMT
< Content-Type: text/html; charset=utf-8
< Vary: X-PJAX, Accept-Encoding, Accept, X-Requested-With
< permissions-policy: interest-cohort=()
< Location: https://github-releases.githubusercontent.com/140419044/0d0a0080-a2e2-11eb-8f2c-cb3987bd2660?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20210702%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20210702T174828Z&X-Amz-Expires=300&X-Amz-Signature=7ba2f58dd3d95397a7ff5e8f1de59e68b455c3f5da3d39ea3923be5f3bfc92db&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=140419044&response-content-disposition=attachment%3B%20filename%3DOpenJDK11U-jdk_x64_linux_hotspot_11.0.11_9.tar.gz&response-content-type=application%2Foctet-stream
< Cache-Control: no-cache
< Strict-Transport-Security: max-age=31536000; includeSubdomains; preload
< X-Frame-Options: deny
< X-Content-Type-Options: nosniff
< X-XSS-Protection: 0
< Referrer-Policy: no-referrer-when-downgrade
< Expect-CT: max-age=2592000, report-uri="https://api.github.com/_private/browser/errors"
< Content-Security-Policy: default-src 'none'; base-uri 'self'; block-all-mixed-content; connect-src 'self' uploads.github.com www.githubstatus.com collector.githubapp.com api.github.com github-cloud.s3.amazonaws.com github-production-repository-file-5c1aeb.s3.amazonaws.com github-production-upload-manifest-file-7fdce7.s3.amazonaws.com github-production-user-asset-6210df.s3.amazonaws.com cdn.optimizely.com logx.optimizely.com/v1/events translator.github.com wss://alive.github.com *.actions.githubusercontent.com wss://*.actions.githubusercontent.com online.visualstudio.com/api/v1/locations insights.github.com; font-src github.githubassets.com; form-action 'self' github.com gist.github.com; frame-ancestors 'none'; frame-src render.githubusercontent.com render-temp.githubusercontent.com viewscreen.githubusercontent.com; img-src 'self' data: github.githubassets.com identicons.github.com collector.githubapp.com github-cloud.s3.amazonaws.com secured-user-images.githubusercontent.com/ *.githubusercontent.com; manifest-src 'self'; media-src github.com user-images.githubusercontent.com/; script-src github.githubassets.com; style-src 'unsafe-inline' github.githubassets.com; worker-src github.com/socket-worker-3f088aa2.js gist.github.com/socket-worker-3f088aa2.js
< Content-Length: 657
< X-GitHub-Request-Id: D622:5D0B:250BE1:26E4E6:60DF516B
<
* Ignoring the response-body
{ [data not shown]
######################################################################## 100.0%* Connection #1 to host github.com left intact
* Issue another request to this URL: 'https://github-releases.githubusercontent.com/140419044/0d0a0080-a2e2-11eb-8f2c-cb3987bd2660?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20210702%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20210702T174828Z&X-Amz-Expires=300&X-Amz-Signature=7ba2f58dd3d95397a7ff5e8f1de59e68b455c3f5da3d39ea3923be5f3bfc92db&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=140419044&response-content-disposition=attachment%3B%20filename%3DOpenJDK11U-jdk_x64_linux_hotspot_11.0.11_9.tar.gz&response-content-type=application%2Foctet-stream'
######################################################################## 100.0%* About to connect() to github-releases.githubusercontent.com port 443 (#2)
* Trying 185.199.108.154...
* Connected to github-releases.githubusercontent.com (185.199.108.154) port 443 (#2)
* CAfile: /etc/pki/tls/certs/ca-bundle.crt
CApath: none
* SSL connection using TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
* Server certificate:
* subject: CN=www.github.com,O="GitHub, Inc.",L=San Francisco,ST=California,C=US
* start date: May 06 00:00:00 2020 GMT
* expire date: Apr 14 12:00:00 2022 GMT
* common name: www.github.com
* issuer: CN=DigiCert SHA2 High Assurance Server CA,OU=www.digicert.com,O=DigiCert Inc,C=US
> GET /140419044/0d0a0080-a2e2-11eb-8f2c-cb3987bd2660?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20210702%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20210702T174828Z&X-Amz-Expires=300&X-Amz-Signature=7ba2f58dd3d95397a7ff5e8f1de59e68b455c3f5da3d39ea3923be5f3bfc92db&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=140419044&response-content-disposition=attachment%3B%20filename%3DOpenJDK11U-jdk_x64_linux_hotspot_11.0.11_9.tar.gz&response-content-type=application%2Foctet-stream HTTP/1.1
> Range: bytes=192792051-
> User-Agent: curl/7.29.0
> Host: github-releases.githubusercontent.com
> Accept: */*
>
< HTTP/1.1 416 Range Not Satisfiable
< Connection: keep-alive
< Content-Length: 0
< x-amz-id-2: KwKxHMi3ygBv4f7jJzhbtztvmPi/8myDw2pEs8dqR2YOT0oqmbC1Je0h724+2d+5fmMOic1PZ6s=
< x-amz-request-id: 3FX5VJS2YEGWZ7Z9
< Last-Modified: Wed, 21 Apr 2021 19:42:24 GMT
< ETag: "0809655a9965bcd6d3eefd4b918c07c6"
< Content-Disposition: attachment; filename=OpenJDK11U-jdk_x64_linux_hotspot_11.0.11_9.tar.gz
< Content-Type: application/octet-stream
< Server: AmazonS3
< Via: 1.1 varnish, 1.1 varnish
< Accept-Ranges: bytes
< Age: 0
< Content-Range: bytes */192792051
< Date: Fri, 02 Jul 2021 17:48:29 GMT
< X-Served-By: cache-dca12929-DCA, cache-nrt18321-NRT
< X-Cache: MISS, MISS
< X-Cache-Hits: 0, 0
< Strict-Transport-Security: max-age=31536000
< X-Fastly-Request-ID: 4265a81244b61078f139b612fb946a2fd90210c8
<
* Connection #2 to host github-releases.githubusercontent.com left intact
Downloaded binary to: /root/.sdkman/tmp/java-11.0.11.hs-adpt.bin
Get post-installation hook: https://api.sdkman.io/2/hooks/post/java/11.0.11.hs-adpt/linuxx64
Copy remote post-installation hook: /root/.sdkman/tmp/hook_post_java_11.0.11.hs-adpt.sh
A Linux post-install hook was found for Java 11.0.11.hs-adpt.
Download has failed, aborting!
Can not install java 11.0.11.hs-adpt at this time...