Setting Up GraalVM
Somnath Musib edited this page Dec 6, 2021
·
6 revisions
In this section, we'll discuss how to set up GraalVM.
- Download GraalVM installer from https://www.graalvm.org/downloads/
- For this demonstration, we'll use Java 11 based installer
- Once downloaded, extract the components
- Browse to Environment variables and set the root folder as the JAVA_HOME environment variable as the user variable
- Edit the path environment variable and include %JAVA_HOME%/bin
- Open a command prompt window and validate the Java version with the
java --version
command: e.g.
> java --version
openjdk 11.0.13 2021-10-19
OpenJDK Runtime Environment GraalVM CE 21.3.0 (build 11.0.13+7-jvmci-21.3-b05)
OpenJDK 64-Bit Server VM GraalVM CE 21.3.0 (build 11.0.13+7-jvmci-21.3-b05, mixed mode, sharing)
The java is now pointed to GraalVM.
- Install
native-image
using the GraalVM Updated tool with the following command
> gu install native-image
Downloading: Release index file from oca.opensource.oracle.com
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.3.0)
- Post installation, access the
native-image
version with the following command:
> native-image --version
GraalVM 21.3.0 Java 11 CE (Java Version 11.0.13+7-jvmci-21.3-b05)
- Download GraalVM installer from https://www.graalvm.org/downloads/
- For this demonstration, we'll use Java 11 based installer
- Once downloaded, extract the tar.gz file and set the root folder as the JAVA_HOME environment variable. Also set the $JAVA_HOME\bin e.g.
> export JAVA_HOME=/home/musibs/graalvm-ce-java11-21.3.0
> export PATH=$PATH:$JAVA_HOME/bin
- Open a terminal window and validate the Java version with the
java --version
command: e.g.
> java --version
openjdk 11.0.13 2021-10-19
OpenJDK Runtime Environment GraalVM CE 21.3.0 (build 11.0.13+7-jvmci-21.3-b05)
OpenJDK 64-Bit Server VM GraalVM CE 21.3.0 (build 11.0.13+7-jvmci-21.3-b05, mixed mode, sharing)
- Install native-image
> gu install native-image
Downloading: Release index file from oca.opensource.oracle.com
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.3.0)
- Check native-image version:
> native-image --version
GraalVM 21.3.0 Java 11 CE (Java Version 11.0.13+7-jvmci-21.3-b05)
Supplementary content for the Spring Boot in Practice book