A Complete Guide to Downloading, Installing, and Using Microsoft Build of OpenJDK 17
The Microsoft Build of OpenJDK 17 is a free, open-source, long-term support (LTS) distribution of the Java Development Kit, backed by Microsoft and aligned 100% with upstream OpenJDK standards. Released in September 2021, it receives 8 years of free public support (until September 2029), with extended paid support available for enterprise customers.
As the default JDK for all Azure Java workloads, it is optimized for integration with the Microsoft ecosystem (VS Code, Azure Spring Apps, GitHub Actions, etc.) while remaining a fully TCK-compliant drop-in replacement for any other OpenJDK distribution. It supports x64 and ARM64 architectures across Windows, macOS, and Linux, including musl-based Alpine Linux for containerized workloads, with no commercial licensing fees for any use case.
This guide covers end-to-end steps to download, install, configure, and use Microsoft OpenJDK 17, along with best practices and troubleshooting tips for both individual developers and enterprise teams.
Guaranteed LTS Support: 8 years of free public security and performance updates, aligned with OpenJDK's quarterly Critical Patch Update (CPU) cadence.
100% TCK Compliant: Passes all Java SE 17 Technology Compatibility Kit tests, ensuring no compatibility gaps with standard Java specifications.
Ecosystem Optimizations: Pre-integrated with VS Code Java tooling, Azure App Service, Azure Functions, and GitHub Actions Java runners for reduced configuration overhead.
Container-First Design: Small, hardened container images available on Microsoft Container Registry (MCR), with built-in support for Class Data Sharing (CDS) and Kubernetes memory limit auto-detection.
No Licensing Costs: Free for commercial and non-commercial use, with no subscription or usage fees, unlike Oracle's commercial JDK distributions.
Download the macOS x64 or ARM64 PKG installer from the official download page
Open the PKG file and follow the setup prompts; the installer will automatically install the JDK to /Library/Java/JavaVirtualMachines/microsoft-17.jdk/
# Download the latest tar.gz archive from the official download pagewget https://aka.ms/download-jdk/microsoft-jdk-17-linux-x64.tar.gz# Extract to the system JVM directorysudo tar xzf microsoft-jdk-17-linux-x64.tar.gz -C /usr/lib/jvm/# Set as default Java runtimesudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/microsoft-jdk-17*/bin/java 100sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/microsoft-jdk-17*/bin/javac 100
Environment Variable Management: Add $JAVA_HOME/bin to the start of your PATH variable to avoid conflicts with other installed JDK versions. For per-user installs, set JAVA_HOME in ~/.bashrc, ~/.zshrc (Linux/macOS) or user-level environment variables (Windows).
Version Pinning: In enterprise environments, pin the JDK version to avoid unexpected updates:
APT: sudo apt-mark hold msopenjdk-17
DNF: sudo dnf versionlock msopenjdk-17
Containers: Use explicit image tags like mcr.microsoft.com/openjdk/jdk:17-ubuntu instead of latest
Container Optimization: Use distroless or Alpine-based Microsoft OpenJDK images for smaller attack surfaces, and enable CDS to reduce application startup time by 30-50%. Use -XX:MaxRAMPercentage=75.0 instead of fixed -Xmx values to dynamically adjust heap size based on container memory limits.
**Update Cadence: Apply quarterly CPU updates within 30 days of release to address critical security vulnerabilities. Subscribe to the Microsoft OpenJDK release notes feed for update alerts.
IDE Configuration: In VS Code, IntelliJ, or Eclipse, set your project SDK to Microsoft OpenJDK 17 to leverage ecosystem-specific optimizations. The VS Code Extension Pack for Java automatically detects Microsoft OpenJDK installations.
JAVA_HOME points to the wrong JDK: Manually set JAVA_HOME to the root of your Microsoft OpenJDK 17 installation, and ensure it appears before other Java paths in your PATH variable.
Conflicting Java versions: Use update-alternatives --config java (Linux) or /usr/libexec/java_home -v 17 (macOS) to set Microsoft OpenJDK 17 as the default runtime.
Apple Silicon performance issues: Ensure you installed the ARM64 build of Microsoft OpenJDK 17, not the x64 build which runs via Rosetta emulation.
Legacy application compatibility errors: Use the jdeps tool to identify usage of deprecated or encapsulated APIs, and add --add-opens flags to your runtime command to grant access to required modules.
Migrating to Microsoft OpenJDK 17 from Other Distributions#
Microsoft OpenJDK 17 is a drop-in replacement for any TCK-compliant JDK 17 distribution:
Uninstall your existing JDK (optional, you can run multiple JDKs side-by-side)
Install Microsoft OpenJDK 17 using the steps above
Update all environment variables, IDE configurations, and CI/CD pipeline settings to point to the new JDK
Run your full application test suite to confirm no compatibility issues
Roll out to staging environments first, then production
For migrations from JDK 8 or 11, follow the OpenJDK migration guide to address module system and deprecated API changes, which apply to all JDK 17 distributions.