Last Updated:

A Complete Guide to SapMachine 21 Download, Installation, and Deployment

If you’re building enterprise Java applications for SAP ecosystems, or looking for a stable, production-grade OpenJDK distribution with long-term support, SapMachine 21 is one of the most compelling options available. Developed and maintained by SAP, SapMachine is a fully TCK-certified downstream distribution of OpenJDK, optimized for SAP workloads while remaining fully compatible with standard Java SE specifications. As the LTS (Long-Term Support) release aligned with OpenJDK 21, SapMachine 21 receives security and performance updates until 2032, making it ideal for both SAP-specific deployments (including S/4HANA extensions, SAP BTP workloads) and general enterprise Java microservices. This guide will walk you through every step of downloading, installing, verifying, and configuring SapMachine 21, along with best practices and troubleshooting tips to ensure a smooth deployment.


Table of Contents#

  1. What is SapMachine 21? Key Features & Use Cases
  2. Pre-Download Prerequisites
  3. Step-by-Step SapMachine 21 Download & Installation Guides 3.1 Manual Download from Official Website 3.2 Package Manager Installation 3.3 Docker Container Deployment
  4. Post-Installation Verification Steps
  5. Common Configuration Examples
  6. Best Practices for SapMachine 21 Deployment
  7. Troubleshooting Common Issues
  8. References

What is SapMachine 21? Key Features & Use Cases#

SapMachine 21 is SAP’s official distribution of OpenJDK 21 LTS, with SAP-specific enhancements and extended support. Key features include:

  • Full Java SE 21 compatibility (TCK certified, so all standard Java applications run without modification)
  • Extended support until 2032 (9 years of security and performance patches, longer than many third-party OpenJDK distributions)
  • Built-in optimizations for SAP workloads (improved HANA JDBC connection performance, native SAP BTP integration, and support for IBM Power/PPC64LE architectures used in SAP on-premise deployments)
  • Dual licensing: Free for community use under GPLv2 + Classpath Exception, with commercial support available via SAP support contracts
  • Full support for Java 21 features including virtual threads, pattern matching for switch, structured concurrency previews, and sequenced collections

Common Use Cases#

  • S/4HANA extension development and deployment
  • SAP BTP (Cloud Foundry, Kyma) workloads
  • On-premise SAP NetWeaver Java stack upgrades
  • General enterprise Java microservice deployments
  • Migration of legacy Java applications to a supported LTS runtime

Pre-Download Prerequisites#

Before downloading SapMachine 21, confirm the following requirements are met:

CategoryRequirements
Operating SystemWindows 10+/Server 2019+, macOS 11 (Big Sur)+, Linux (RHEL 8+, SLES 15+, Ubuntu 20.04+, Debian 11+, Alpine 3.17+)
HardwareMinimum 2GB RAM, 1GB free disk space (JDK: ~300MB unpacked, JRE: ~100MB unpacked)
Architecturex86_64 (AMD64), AArch64 (ARM64 for Apple Silicon, AWS Graviton), PPC64LE (IBM Power)
Package SelectionUse JDK (Java Development Kit) for development workflows (includes compiler, debug tools, and monitoring utilities). Use JRE (Java Runtime Environment) for production deployments (smaller footprint, reduced attack surface)
SupportA valid SAP support contract is required for official production support; community support is available via GitHub for non-commercial use

Step-by-Step SapMachine 21 Download & Installation Guides#

3.1 Manual Download from Official Website#

This method is recommended for one-off installations or environments with restricted internet access:

  1. Navigate to the official SapMachine download page
  2. Use the filter menu to select:
    • Version: 21 (LTS)
    • Operating System: Your OS (Windows, macOS, Linux)
    • Architecture: Your system architecture (x86_64, AArch64, PPC64LE)
    • Package Type: JDK or JRE, and preferred archive format (zip, msi, pkg, tar.gz)
  3. Accept the GPLv2 + Classpath Exception license to start the download
  4. Verify the binary checksum (critical best practice) to avoid corrupted or tampered files:
    # Windows (PowerShell)
    certutil -hashfile sapmachine-21.0.3-windows-x64-bin.zip SHA256
     
    # macOS
    shasum -a 256 sapmachine-21.0.3-macos-aarch64-bin.tar.gz
     
    # Linux
    sha256sum sapmachine-21.0.3-linux-x64-bin.tar.gz
    Compare the output to the SHA256 value listed next to the download link on the SapMachine website.
  5. Install the binary:
    • Windows MSI: Double-click the installer, follow the wizard, and check the option to set JAVA_HOME and add SapMachine to your system PATH when prompted
    • macOS PKG/DMG: Open the installer and follow the prompts; the runtime will be installed to /Library/Java/JavaVirtualMachines/sapmachine-21.jdk
    • Linux tar.gz: Extract to a system-wide or user-specific directory:
      # System-wide installation
      sudo tar -xzf sapmachine-21.0.3-linux-x64-bin.tar.gz -C /usr/lib/jvm/

3.2 Package Manager Installation#

Package managers are the recommended method for most use cases, as they simplify updates and security patching:

Windows (Winget/Chocolatey)#

# Winget (built into Windows 11+)
winget install SAP.SapMachine.21.JDK # For JDK
winget install SAP.SapMachine.21.JRE # For JRE
 
# Chocolatey
choco install sapmachine21

macOS (Homebrew)#

# For Intel and Apple Silicon
brew install --cask sapmachine-jdk@21

Debian/Ubuntu#

# Add the official SapMachine repo
wget -qO - https://dist.sapmachine.io/debian/sapmachine.key | sudo gpg --dearmor -o /usr/share/keyrings/sapmachine-archive-keyring.gpg
echo "deb [signed-by=/usr/share/keyrings/sapmachine-archive-keyring.gpg] https://dist.sapmachine.io/debian/amd64/ ./" | sudo tee /etc/apt/sources.list.d/sapmachine.list
 
# Install SapMachine 21
sudo apt update && sudo apt install sapmachine-21-jdk # Or sapmachine-21-jre for runtime

RHEL/CentOS/Fedora#

# Add official repo
sudo dnf config-manager --add-repo https://dist.sapmachine.io/rpm/sapmachine.repo
 
# Install
sudo dnf install sapmachine-21-jdk

SLES#

# Add official repo
sudo zypper addrepo https://dist.sapmachine.io/rpm/sapmachine.repo
 
# Install
sudo zypper install sapmachine-21-jdk

3.3 Docker Container Deployment#

Official SapMachine 21 images are hosted on Docker Hub, optimized for containerized deployments:

# Pull full JDK image for build pipelines
docker pull sapmachine:21
 
# Pull slim JRE image for production (smaller footprint, ~100MB)
docker pull sapmachine:21-jre-slim

Example Dockerfile for a Spring Boot 3.x App#

# Build stage with SapMachine 21 JDK
FROM sapmachine:21 AS builder
WORKDIR /app
COPY . .
RUN ./mvnw clean package -DskipTests
 
# Production stage with slim JRE
FROM sapmachine:21-jre-slim
WORKDIR /app
COPY --from=builder /app/target/my-spring-boot-app.jar app.jar
EXPOSE 8080
CMD ["java", "-jar", "app.jar"]

Post-Installation Verification Steps#

Confirm your SapMachine 21 installation is working correctly with these steps:

  1. Check the Java runtime version:
    java -version
    Expected output:
    openjdk version "21.0.3" 2024-04-16 LTS
    OpenJDK Runtime Environment SapMachine (build 21.0.3+9-LTS-sapmachine)
    OpenJDK 64-Bit Server VM SapMachine (build 21.0.3+9-LTS-sapmachine, mixed mode, sharing)
    
  2. If you installed the JDK, verify the compiler works:
    javac -version
    # Expected output: javac 21.0.3
  3. Verify JAVA_HOME is set correctly:
    # Windows PowerShell
    echo $env:JAVA_HOME
     
    # macOS/Linux
    echo $JAVA_HOME
    The path should point to the root of your SapMachine 21 installation (not the bin subdirectory)
  4. Test a Java 21-specific feature (virtual threads): Create a file VirtualThreadTest.java with the following content:
    import java.util.concurrent.Executors;
     
    public class VirtualThreadTest {
        public static void main(String[] args) {
            try (var executor = Executors.newVirtualThreadPerTaskExecutor()) {
                for (int i = 0; i < 5; i++) {
                    int taskId = i;
                    executor.submit(() -> System.out.printf("Virtual thread %d running successfully%n", taskId));
                }
            }
            System.out.println("SapMachine 21 is working correctly with Java 21 features!");
        }
    }
    Compile and run:
    javac VirtualThreadTest.java && java VirtualThreadTest

Common Configuration Examples#

Set JAVA_HOME Permanently#

  • Windows: Navigate to System Properties > Advanced > Environment Variables, add a system variable JAVA_HOME pointing to your SapMachine installation path, and add %JAVA_HOME%\bin to your system PATH
  • macOS (zsh): Add the following to ~/.zshrc:
    export JAVA_HOME=$(/usr/libexec/java_home -v 21)
    Run source ~/.zshrc to apply changes
  • Linux (bash): Add the following to ~/.bashrc or /etc/profile for system-wide use:
    export JAVA_HOME=/usr/lib/jvm/sapmachine-21-jdk
    export PATH=$JAVA_HOME/bin:$PATH

JVM Configuration for SAP S/4HANA Extensions#

java -Xms2G -Xmx8G -XX:+UseG1GC -XX:MaxGCPauseMillis=200 -jar s4hana-extension.jar

This configuration is optimized for low-latency interactions with HANA databases, using the default G1 garbage collector available in Java 21.


Best Practices for SapMachine 21 Deployment#

  1. Use JRE for production deployments: The JRE eliminates unnecessary development tools, reducing the attack surface and container image size by ~70%
  2. Always verify checksums for manual downloads: Avoid tampered or corrupted binaries by cross-checking SHA256 hashes from the official SapMachine site
  3. Use package managers for server deployments: Simplify security patching with a single apt update && apt upgrade or equivalent command, aligned with OpenJDK quarterly CPU updates
  4. Pin container image versions: Avoid using the latest tag for production; use specific version tags like sapmachine:21.0.3-jre-slim to prevent unexpected breaking changes
  5. Align patch versions across environments: Use the exact same SapMachine 21 patch version in development, test, and production to eliminate "it works on my machine" errors
  6. Use AArch64 builds for ARM systems: For Apple Silicon or AWS Graviton deployments, use native AArch64 builds instead of x86_64 emulation for 20-30% better performance
  7. Only download from official sources: Avoid third-party mirror sites to reduce the risk of malware; use only the official SapMachine website, package repos, or Docker Hub
  8. Enable SAP optimizations: The flag -XX:+UseSapOptimizations is enabled by default in SapMachine 21, improving performance for HANA JDBC connections and SAP BTP services

Troubleshooting Common Issues#

IssueSolution
Checksum verification failsRe-download the binary using a stable internet connection, and confirm you copied the correct SHA256 hash from the official SapMachine site
java -version returns an older Java versionCheck your PATH variable to ensure the SapMachine 21 bin directory is listed before other Java installations. On Linux, run sudo update-alternatives --config java to set the default runtime
JAVA_HOME is not recognizedRestart your terminal/shell after setting environment variables, and confirm the path points to the root of the SapMachine installation (not the bin subdirectory)
Permission denied errors on Linux/macOSRun chmod +x $JAVA_HOME/bin/java to grant execute permissions, or use sudo for system-wide installation commands
Docker pull failsConfigure Docker proxy settings if you are behind a corporate firewall, and confirm you are using a valid image tag for your system architecture
Poor performance for SAP workloadsUpdate to the latest patch version of SapMachine 21, ensure you are using the official SAP HANA JDBC driver, and confirm G1GC is enabled (default in Java 21)

References#

  1. Official SapMachine Website
  2. SapMachine GitHub Repository
  3. SapMachine 21 Release Notes
  4. OpenJDK 21 Official Documentation
  5. SAP Support Portal for SapMachine
  6. SapMachine Official Docker Hub