Installing Java Development Kit (JDK)
OpenJDK distributors excluding Oracle
-
OpenJDK: The open-source implementation of the Java Platform, providing core libraries and APIs. It serves as the basis for many Java distributions.
- Website: openjdk.java.net
-
AdoptOpenJDK: A community-driven effort to provide free, open-source OpenJDK binaries for a variety of platforms. It is now part of the Eclipse Adoptium project.
- Website: adoptopenjdk.net
-
Amazon Corretto: Amazon distributes a no-cost, multiplatform, production-ready distribution of OpenJDK, with long-term support.
- Website: aws.amazon.com/corretto
-
Azul Systems: Provides Zulu OpenJDK builds, which are tested, certified, and fully compliant OpenJDK distributions.
- Website: azul.com/downloads/zulu-community
-
Microsoft: Offers OpenJDK builds for Windows, macOS, and Linux, providing binaries through their Azure and other platforms.
Linux (CentOS/RHEL using yum)
-
Find the OpenJDK version you want to install(we use Open JDK distribution).
sudo yum search openjdk
-
Install OpenJDK JDK:
sudo yum install -y java-21-openjdk-devel
-
Verify Installation:
java -version
-
Shift between versions(like
javac
)update-alternatives --config javac
Linux (Ubuntu/Debian using apt)
-
Find the OpenJDK version you want to install(we use Open JDK distribution).
sudo apt search openjdk
-
Install OpenJDK:
sudo apt install -y openjdk-21-jdk
-
Verify Installation:
java -version
-
Shift between versions(like
javac
)update-alternatives --config javac
macOS
-
Find the OpenJDK version you want to install(we use Open JDK distribution).
brew search openjdk
-
Install Java using Homebrew:
brew install openjdk@21
-
Set Java Home (Optional):
echo export "JAVA_HOME=\$(/usr/libexec/java_home)" >> ~/.zshrc source ~/.zshre
-
Verify Installation:
java -version
Windows
-
Download JDK:
- Download the JDK installer from the official Oracle OpenJDK website.
-
Run Installer:
- Run the downloaded installer and follow the installation wizard instructions.
-
Set Java Environment Variables (Optional):
- Set JAVA_HOME to the JDK installation directory.
- Update PATH to include the JDK’s bin directory.
-
Verify Installation:
- Open Command Prompt and type:
java -version