[asdf Java] Use asdf java plugin to install GraalVM Java

asdf install GraalVM Java

GraalVM Java is the High-performance runtime with new compiler optimizations to accelerate Java application performance and lower infrastructure costs on premises and in the cloud. GraalVM Java provides new innovation for the Java platform:

  • Makes Java applications go faster

  • True microservice solution for Java

  • Perfect for containerized workloads

asdf is a single CLI tool for managing multiple runtime versions. It extend with a simple plugin system to install your favourite language: Dart, Elixir, Flutter, Golang (Go), Java, Node.js, Python, Ruby …

This article is about how to use asdf and Java plugin to install GraalVM Java on macOS with the Homebrew package manager.

Prerequisites

  • Xcode Command Line Tools
    The Xcode Command Line Tools Package is a small self-contained package available for download separately from Xcode and that allows you to do command line development in macOS which is consists of the macOS SDK and command-line tools such as Clang, which are installed at this

    For more information about installing and using Xcode Command Line Tools, see the Xcode Command Line Tools

  • Homebrew
    Homebrew is the Missing Package Manager for macOS (or Linux).

    For more information about installing and using Homebrew, see the Homebrew - https://brew.sh/.

Installation

Install asdf

1
2
3
4
5
# Install asdf dependencies
$ brew install coreutils curl git

# Install asdf
$ brew install asdf

asdf Java Plugin

1
2
3
4
5
# Install Java plugin requirements
$ brew install openssl readline

# Install Java plugin
$ asdf plugin-add java https://github.com/halcyon/asdf-java.git

List all Java Version

Update Java plugin.

1
$ asdf plugin update java

List all Java versions.

1
$ asdf list all java | grep graalvm

Install Java version

Install a Java version manually.

1
2
3
4
5
6
7
8
9
10
11
12
13
$ asdf install java graalvm-21.3.0+java17

$ java version
No version set for command java
Consider adding one of the following versions in your config file at ~/.tool-versions
java graalvm-21.3.0+java17

$ echo "java graalvm-21.3.0+java17" >> ~/.tool-versions

$ asdf exec java -version
openjdk 17.0.1 2021-10-19
OpenJDK Runtime Environment GraalVM CE 21.3.0 (build 17.0.1+12-jvmci-21.3-b05)
OpenJDK 64-Bit Server VM GraalVM CE 21.3.0 (build 17.0.1+12-jvmci-21.3-b05, mixed mode, sharing)

References

[1] Manage asdf - https://asdf-vm.com/#/core-manage-asdf

[2] GitHub - halcyon/asdf-java: A Java plugin for asdf-vm. - https://github.com/halcyon/asdf-java

[3] Home · rbenv/java-build Wiki - https://github.com/rbenv/java-build/wiki#suggested-build-environment

[4] Homebrew - https://brew.sh/

[5] Java | GraalVM - https://www.graalvm.org/java/

[6] GraalVM - https://www.graalvm.org/

[6] Java | Oracle - https://www.java.com/en/