Skip to content

Instantly share code, notes, and snippets.

@DeltaLaboratory
Created April 18, 2023 09:09
Show Gist options
  • Save DeltaLaboratory/41cd8e0efc8fbd103058f3c63facad8b to your computer and use it in GitHub Desktop.
Save DeltaLaboratory/41cd8e0efc8fbd103058f3c63facad8b to your computer and use it in GitHub Desktop.
GraalVM Installer
#!/bin/bash
# Set the Java version you want to use
JAVA_VERSION="19"
# Set the architecture
ARCHITECTURE="amd64"
# Set the installation directory
INSTALL_DIR="$HOME/graalvm"
# Get the latest GraalVM version
GRAALVM_VERSION=$(curl -s https://api.github.com/repos/graalvm/graalvm-ce-builds/releases/latest | grep -oP '"tag_name": "\K(.*)(?=")')
# Download GraalVM
curl -LJ -o graalvm.tar.gz https://github.com/graalvm/graalvm-ce-builds/releases/download/$GRAALVM_VERSION/graalvm-ce-java$JAVA_VERSION-linux-$ARCHITECTURE-${GRAALVM_VERSION:3}.tar.gz
# Create the installation directory
mkdir -p $INSTALL_DIR
# Extract the archive
tar -xzf graalvm.tar.gz -C $INSTALL_DIR --strip-components=1
# Remove the archive
rm graalvm.tar.gz
# Set environment variables
export PATH=$INSTALL_DIR/bin:$PATH
export JAVA_HOME=$INSTALL_DIR
# Check the installation
java -version
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment