1、使用sdk man
用curl安装sdk man : curl -s"https://get.sdkman.io" | bash
配置sdk man :source "$HOME/.sdkman/bin/sdkman-init.sh"
2、安装GraalVm
2.1、查看Java虚拟机列表
命令:sdk list java
==== BROADCAST =================================================================
* 2021-04-28: micronaut 2.5.0 available on SDKMAN!
* 2021-04-27: kscript 3.1.0 available on SDKMAN!
* 2021-04-27: micronaut 2.4.4 available on SDKMAN!
================================================================================
================================================================================
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
| | 16.0.0.j9 | adpt | | 16.0.0.j9-adpt
| | 16.0.0.hs | adpt | | 16.0.0.hs-adpt
| | 11.0.11.j9 | adpt | | 11.0.11.j9-adpt
| | 11.0.11.hs | adpt | | 11.0.11.hs-adpt
| | 11.0.10.j9 | adpt | | 11.0.10.j9-adpt
| | 11.0.10.hs | adpt | | 11.0.10.hs-adpt
| | 8.0.292.j9 | adpt | | 8.0.292.j9-adpt
| | 8.0.292.hs | adpt | | 8.0.292.hs-adpt
| | 8.0.282.j9 | adpt | | 8.0.282.j9-adpt
| | 8.0.282.hs | adpt | | 8.0.282.hs-adpt
Amazon | | 16.0.1.9.1 | amzn | | 16.0.1.9.1-amzn
| | 16.0.0.36.1 | amzn | | 16.0.0.36.1-amzn
| | 15.0.2.7.1 | amzn | | 15.0.2.7.1-amzn
| | 11.0.11.9.1 | amzn | | 11.0.11.9.1-amzn
| | 11.0.10.9.1 | amzn | | 11.0.10.9.1-amzn
| | 8.292.10.1 | amzn | | 8.292.10.1-amzn
| | 8.282.08.1 | amzn | | 8.282.08.1-amzn
Azul Zulu | | 16.0.1 | zulu | | 16.0.1-zulu
| | 16.0.0 | zulu | | 16.0.0-zulu
| | 16.0.0.fx | zulu | | 16.0.0.fx-zulu
| | 15.0.2.fx | zulu | | 15.0.2.fx-zulu
| | 11.0.11 | zulu | | 11.0.11-zulu
| | 11.0.10 | zulu | | 11.0.10-zulu
| | 11.0.10.fx | zulu | | 11.0.10.fx-zulu
| | 8.0.292 | zulu | | 8.0.292-zulu
| | 8.0.282 | zulu | | 8.0.282-zulu
| | 8.0.282.fx | zulu | | 8.0.282.fx-zulu
| | 7.0.302 | zulu | | 7.0.302-zulu
| | 7.0.292 | zulu | | 7.0.292-zulu
BellSoft | | 16.0.1.fx | librca | | 16.0.1.fx-librca
| | 16.0.1 | librca | | 16.0.1-librca
| | 16.0.0.fx | librca | | 16.0.0.fx-librca
| | 16.0.0 | librca | | 16.0.0-librca
| | 11.0.11.fx | librca | | 11.0.11.fx-librca
| | 11.0.11 | librca | | 11.0.11-librca
| | 11.0.10.fx | librca | | 11.0.10.fx-librca
| | 11.0.10 | librca | | 11.0.10-librca
| | 8.0.292.fx | librca | | 8.0.292.fx-librca
| | 8.0.292 | librca | | 8.0.292-librca
| | 8.0.282.fx | librca | | 8.0.282.fx-librca
| | 8.0.282 | librca | | 8.0.282-librca
GraalVM | | 21.1.0.r16 | grl | | 21.1.0.r16-grl
| | 21.1.0.r11 | grl | | 21.1.0.r11-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.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.5.r11 | grl | | 19.3.5.r11-grl
| | 19.3.5.r8 | grl | | 19.3.5.r8-grl
Java.net | | 17.ea.20 | open | | 17.ea.20-open
| | 17.ea.19 | open | | 17.ea.19-open
| | 17.ea.6.lm | open | | 17.ea.6.lm-open
| | 17.ea.2.pma | open | | 17.ea.2.pma-open
| | 16 | open | | 16-open
| | 16.0.1 | open | | 16.0.1-open
| | 11.0.2 | open | | 11.0.2-open
Microsoft | | 11.0.11.9.1 | ms | | 11.0.11.9.1-ms
| | 11.0.10.9 | ms | | 11.0.10.9-ms
SAP | | 16 | sapmchn | | 16-sapmchn
| | 16.0.1 | sapmchn | | 16.0.1-sapmchn
| | 15.0.2 | sapmchn | | 15.0.2-sapmchn
| | 11.0.11 | sapmchn | | 11.0.11-sapmchn
| | 11.0.10 | sapmchn | | 11.0.10-sapmchn
TravaOpenJDK | | 11.0.9 | trava | | 11.0.9-trava
| | 8.0.232 | trava | | 8.0.232-trava
2.2、安装:GraalVM
➜ ~ sdk install java 21.1.0.r11-grl
Downloading: java 21.1.0.r11-grl
In progress...
############################################################################################################################################################################################### 100.0%############################################################################################################################################################################################### 100.0%
Repackaging Java 21.1.0.r11-grl...
Done repackaging...
Cleaning up residual files...
Installing: java 21.1.0.r11-grl
Done installing!
Setting java 21.1.0.r11-grl as default.
➜ ~ Java -version
openjdk version "11.0.11" 2021-04-20
OpenJDK Runtime Environment GraalVM CE 21.1.0 (build 11.0.11+8-jvmci-21.1-b05)
OpenJDK 64-Bit Server VM GraalVM CE 21.1.0 (build 11.0.11+8-jvmci-21.1-b05, mixed mode, sharing) (安装成功)
2.3、安装本地镜像
➜ ~ gu list
ComponentId Version Component name Stability Origin
---------------------------------------------------------------------------------------------------------------------------------
graalvm 21.1.0 GraalVM Core -
js 21.1.0 Graal.js Supported
➜ ~ gu install native-image
Downloading: Component catalog from www.graalvm.org
Processing Component: Native Image
Downloading: Component native-image: Native Image from github.com
Installing new component: Native Image (org.graalvm.native-image, version 21.1.0)