Install GraalVM and it’s native-image

By Amin Nasiri

Table of Contents

Install GraalVM and it’s native-image

As a developer, I would like to install the GraalVM on local machine, then I will be able to convert Java applications to native binary executable.

Install SDKMan

We should have GraalVM installed on our local machine and SDKMan will be very useful in this section, and we can still download it and install it like openJDK.

Install SDKMan Mac/Linux:

  $ curl -s "https://get.sdkman.io" | bash

for other OS please see this link https://sdkman.io/install

Install GraalVM

We can get the list of JDK available by SDKMan before install GraalVM.

  $ 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
Corretto 16.0.2.7.1 amzn 16.0.2.7.1-amzn
11.0.12.7.2 amzn 11.0.12.7.2-amzn
8.302.08.1 amzn 8.302.08.1-amzn
GraalVM 21.2.0.r16 grl 21.2.0.r16-grl
21.2.0.r11 grl 21.2.0.r11-grl
21.0.0.2.r8 grl 21.0.0.2.r8-grl
20.3.3.r11 grl 20.3.3.r11-grl
19.3.6.r11 grl 19.3.6.r11-grl
Java.net 18.ea.11 open 18.ea.11-open
18.ea.10 open 18.ea.10-open
18.ea.2.lm open 18.ea.2.lm-open
17.ea.3.pma open 17.ea.3.pma-open
16.0.2 open 16.0.2-open
11.0.2 open 11.0.2-open
Liberica 16.0.2.fx librca 16.0.2.fx-librca
16.0.2 librca 16.0.2-librca
11.0.12.fx librca 11.0.12.fx-librca
11.0.12 librca 11.0.12-librca
8.0.302.fx librca 8.0.302.fx-librca
8.0.302 librca 8.0.302-librca
Liberica NIK 21.2 nik 21.2-nik
Microsoft 16.0.2.7.1 ms 16.0.2.7.1-ms
11.0.12.7.1 ms 11.0.12.7.1-ms
SapMachine 16.0.2 sapmchn 16.0.2-sapmchn
11.0.12 sapmchn 11.0.12-sapmchn
Temurin 16.0.2 tem 16.0.2-tem
11.0.12 tem 11.0.12-tem
8.0.302 tem 8.0.302-tem
Trava 11.0.9 trava 11.0.9-trava
8.0.232 trava 8.0.232-trava
Zulu 16.0.2 zulu 16.0.2-zulu
16.0.2.fx zulu 16.0.2.fx-zulu
11.0.12 zulu 11.0.12-zulu
11.0.12.fx zulu 11.0.12.fx-zulu
8.0.302 zulu 8.0.302-zulu
8.0.302.fx zulu 8.0.302.fx-zulu
7.0.312 zulu 7.0.312-zulu

================================================================================

there are a couple of versions of GraalVM and I want to install latest version.

$ sdk install java 21.2.0.r11-grl
  • Optional Step: Install GraalVM directly without SDKMan and download GraalVM from this link. We should be able to confirm have successful installation.
    $ gu --version

It should be the GraalVM version like GraalVM Updater 21.2.0

Install Native-Image

We need to install native-image to be able to convert Java applications to native binary executable.

  $ gu install native-image

so, it’s time to make sure, this native-image utility install successfully.

  $ native-image --version

and the result will be GraalVM 21.2.0 Java 11 CE (Java Version 11.0.12+6-jvmci-21.2-b08)