Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
This article describes how to install the Microsoft Build of OpenJDK. To get the files mentioned in this article, see Download the Microsoft Build of OpenJDK.
ZIP and TAR.GZ packages
For Windows, Linux, and macOS, we produce ZIP (Windows) and TAR.GZ (Linux/macOS) packages. To install, extract one of these packages in a folder of your choice, then set the JAVA_HOME environment variable to that folder.
Alternatively, you can use native installers for your operating system of choice, as described in the next section.
Native installers
For Windows, we produce an EXE installer with a graphical interface. For macOS, we produce a PKG installer with similar features. These installers automatically make the JDK (Java Development Kit) tools available in your PATH.
For Linux, we produce DEB and RPM packages to be used with apt and rpm.
The following sections provide instructions for these installers.
Install on Windows
To install on any version of Windows, you can use either the EXE installer, or ZIP package. On Windows 10 or later, you can also use the Windows Package Manager from your Windows Terminal.
Note
You should only use one installation method (EXE, MSI, or ZIP) at a time for each JDK version. If you previously installed a given JDK LTS (Long Term Support) version using one method (example: MSI) and want to update it using a different method (example: EXE), you must first uninstall the existing JDK before proceeding with the new installation.
Install on Windows via EXE
The EXE (Windows executable) provides both a graphical and a console-only installation method. If you double-click on the installer file, it launches the traditional Windows application installer, where you can follow the instructions on the screen.
For wide-scale deployment, you can install the EXE on the command line using the following steps:
Download the
.exefile. For more information, see Download the Microsoft Build of OpenJDK.Choose the features you want to install from the following table:
Feature Description FeatureEnvironmentUpdate the PATHenvironment variable. (DEFAULT)FeatureJarFileRunWithAssociate .jar files with Java applications. (DEFAULT) FeatureJavaHomeUpdate the JAVA_HOMEenvironment variable.FeatureOracleJavaSoftUpdates registry keys HKLM\SOFTWARE\JavaSoft\.Note
You can use
FeatureOracleJavaSoftto prevent Oracle Java from launching from PATH when the Microsoft Build of OpenJDK is uninstalled. Reinstall Oracle Java if you need to restore the Oracle registry keys.Run the EXE file from the command line. Use the selected features, as shown in the following example.
.\<package>.exe /SILENT /SUPPRESSMSGBOXES /ALLUSERS /TASKS="FeatureEnvironment,FeatureJarFileRunWith" /DIR="C:\Program Files\Microsoft\"Note
If installing for only the current user, use the flag
/CURRENTUSERinstead of/ALLUSERS.To suppress the progress bar screen of the installation, use the flag
/VERYSILENTinstead of/SILENT.The
/DIRflag is optional. If omitted, then the default installation dir is used based on the installation mode:/ALLUSERSor/CURRENTUSER.
Install on Windows via legacy MSI:
If you experience issues with the EXE installer on JDK 11, JDK 17, or JDK 21, you can uninstall the EXE and use the legacy MSI (Microsoft Installer) for a similar graphical and a console-only installation method. If you double-click on the installer file, it launches the traditional Windows application installer, where you can follow the instructions on the screen.
For wide-scale deployment, you can install the MSI on the command line using the following steps:
Download the
.msifile. For more information, see Download the Microsoft Build of OpenJDK.Choose the features you want to install from the table in step 2 of the Install on Windows via EXE
Note
FeatureMainis a unique, default option for MSI that tells the installer to perform the core installationYou can use optional parameters that group some of the features together, as shown in the following example:
Parameter Features INSTALLLEVEL=1FeatureMain,FeatureEnvironment,FeatureJarFileRunWithRun the
msiexeccommand on the target workstation. Use the selected features, as shown in the following example.msiexec /i <package>.msi ADDLOCAL=FeatureMain,FeatureEnvironment,FeatureJarFileRunWith,FeatureJavaHome INSTALLDIR="c:\Program Files\Microsoft\" /quietNote
You must use
INSTALLDIRwithFeatureMain.This example silently installs the Microsoft Build of OpenJDK, updates the
PATH, associates.jarfiles with Java applications, and definesJAVA_HOME.
Install on Windows with the Windows Package Manager (winget)
To install with the Windows Package Manager, first install winget, and then open Windows Terminal.
Next, use the following command to search for the Microsoft Build of OpenJDK packages:
winget search Microsoft.OpenJDK
The resulting output is similar to:
Name Id Version
--------------------------------------------------------------
Microsoft Build of OpenJDK 25 Microsoft.OpenJDK.25 25.0.1
You can now install the package by referencing the Id, using the command:
winget install Microsoft.OpenJDK.25
This command produces an output similar to:
Found Microsoft Build of OpenJDK 25 [Microsoft.OpenJDK.25]
This application is licensed to you by its owner.
Microsoft is not responsible for, nor does it grant any licences to, third-party packages.
Downloading https://aka.ms/download-jdk/microsoft-jdk-25.0.1-windows-x64.msi
██████████████████████████████ 160 MB / 160 MB
Successfully verified installer hash
Starting package install...
Successfully installed
Install on macOS
Packages for macOS are available through Homebrew or as standalone downloads in PKG (macOS package installer) or TAR.GZ formats.
To install the latest version with Homebrew:
brew install --cask microsoft-openjdk
This command produces output similar to:
==> Downloading https://aka.ms/download-jdk/microsoft-jdk-25.0.1-macos-x64.pkg
Already downloaded: /Users/foobar/Library/Caches/Homebrew/downloads/c3df619c6411aa15151d0306a6a0f9760ff7ab0b54d0b00daade382500369c81--microsoft-jdk-25.0.1-macos-x64.pkg
==> Installing Cask microsoft-openjdk
==> Running installer for microsoft-openjdk; your password may be necessary.
Package installers may write to any location; options such as `--appdir` are ignored.
Password:
installer: Package name is Microsoft Build of OpenJDK
installer: Installing at base path /
installer: The install was successful.
🍺 microsoft-openjdk was successfully installed!
Note
The package microsoft-openjdk points to the latest version of the Microsoft Build of OpenJDK.
To install other major versions with Homebrew:
brew install --cask microsoft-openjdk@11
# OR
brew install --cask microsoft-openjdk@17
# OR
brew install --cask microsoft-openjdk@21
# OR
brew install --cask microsoft-openjdk@25
To install on macOS with the TAR.GZ package, extract the file to your desired location. The JDK is located at <location>/jdk-<version>/Contents/Home.
To install using the PKG installer, open the installer and follow the instructions. By default, the JDK is installed at /Library/Java/JavaVirtualMachines/microsoft-25.jdk/Contents/Home.
Uninstall on macOS
To uninstall the Microsoft Build of OpenJDK installed through Homebrew or PKG, use the following commands:
sudo rm -rf /Library/Java/JavaVirtualMachines/microsoft-25.jdk
sudo pkgutil --forget com.microsoft.25.jdk
To uninstall a package installed using the TAR.GZ file, delete the installation folder.
Install on Ubuntu
To install on Ubuntu 18.04, 20.04, 22.04, and 24.04 LTS versions, open a terminal and run the following commands:
# Valid values are only '18.04', '20.04', '22.04', and '24.04'
# For other versions of Ubuntu, please use the tar.gz package
ubuntu_release=`lsb_release -rs`
wget https://packages.microsoft.com/config/ubuntu/${ubuntu_release}/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
sudo dpkg -i packages-microsoft-prod.deb
After the repository is added, install the Microsoft Build of OpenJDK by running the following commands:
sudo apt-get install apt-transport-https
sudo apt-get update
sudo apt-get install msopenjdk-25
Note
You might have to update your default JDK selection. See here for details.
Install on Debian
Debian 10 - 12
Warning
As of July 2024, official support for Debian 10 is over. All published JDKs up to July 2024 remain available, but won't receive continued updates or support.
To install on Debian 10 through 12, open a terminal and run the following commands:
sudo apt update
sudo apt install wget lsb-release -y
wget https://packages.microsoft.com/config/debian/$(lsb_release -rs)/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
sudo dpkg -i packages-microsoft-prod.deb
After the repository is added, run the following commands:
sudo apt update
sudo apt install msopenjdk-25
Note
You might have to update your default JDK selection. See here for details.
Debian 9
Warning
As of July 2024, official support for Debian 9 is over. All published JDKs up to July 2024 remain available, but won't receive continued updates or support.
To install on Debian 9, open a terminal and run the following commands:
wget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > packages.microsoft.gpg
sudo install -o root -g root -m 644 packages.microsoft.gpg /etc/apt/trusted.gpg.d/
wget -q https://packages.microsoft.com/config/debian/9/prod.list -O /etc/apt/sources.list.d/microsoft-prod.list
After the repository is added, run the following commands:
sudo apt-get install apt-transport-https
sudo apt-get update
sudo apt-get install msopenjdk-25
Note
You might have to update your default JDK selection. See here for details.
Install on SUSE
openSUSE 15
To install on openSUSE 15, open a terminal and run the following commands:
sudo rpm -Uvh https://packages.microsoft.com/config/opensuse/15/packages-microsoft-prod.rpm
sudo zypper update # Note: This will prompt you to set the desired trust level for the Microsoft repository and package signing key
sudo zypper install msopenjdk-25
SLES 15
To install on SLES (SUSE Linux Enterprise Server) 15, open a terminal and run the following commands:
sudo rpm -Uvh https://packages.microsoft.com/config/sles/15/packages-microsoft-prod.rpm
sudo zypper update # Note: This will prompt you to set the desired trust level for the Microsoft repository and package signing key
sudo zypper install msopenjdk-25
Install on CentOS 7 (RPM)
To install on CentOS 7, open a terminal and run the following command:
sudo rpm -Uvh https://packages.microsoft.com/config/centos/7/packages-microsoft-prod.rpm
sudo yum install msopenjdk-25
Note
RPM packages for msopenjdk-25 might not update automatically to the latest minor version. To check for available versions, run yum -v list msopenjdk-25. Then, run yum install msopenjdk-25-<version> to force an update to the specified version. Example: yum install msopenjdk-25-25.0.1-1
Install on Alpine (TAR.GZ)
To install on Alpine, download a tar.gz package for Alpine (see the download page) and extract it to your desired location.
Note
Alpine is only supported for JDK 11 and JDK 17. We don't support Alpine for JDK 21 and later versions.
Change the default JDK on Linux
If you have several versions of OpenJDK installed on your system, use the following command to set the Microsoft Build of OpenJDK as the default:
For Debian/Ubuntu:
sudo update-java-alternatives --set msopenjdk-25-amd64
For CentOS, you can use the alternatives command to manage Java versions.
Provide feedback on the Microsoft Build of OpenJDK
Send us your comments, thoughts, and ideas to help us improve the Microsoft Build of OpenJDK. Visit our OpenJDK discussions page on GitHub to send us your feedback.
Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.