How to install OpenJDK with AdoptOpenJDK Java |Video upload date:  · Duration: PT4M44S  · Language: EN

Step by step guide to install OpenJDK using AdoptOpenJDK on Linux macOS and Windows with commands and verification tips

Quick warning and what you actually need

Installing OpenJDK from AdoptOpenJDK is one of those tasks that sounds boring until some tool refuses to run and you realize JAVA_HOME is not set. This guide tells you which package to pick, how to install it on Linux macOS or Windows, and how to stop your shell from forgetting Java after a reboot.

Pick JDK or JRE and choose a version

If you plan to compile code or run build tools use the JDK. If you only run Java apps the JRE might be enough. For most developers pick an LTS release for stability unless you are chasing a shiny new feature. Yes the temptation is real but stability is a thing.

Get AdoptOpenJDK for your platform

Linux

On Debian and Ubuntu you can use the distro packages for OpenJDK with:

sudo apt update
sudo apt install openjdk-11-jdk

If you prefer AdoptOpenJDK binaries download the tar archive from the AdoptOpenJDK distributions page and extract it into a system JVM folder or a user directory if you do not want to use sudo.

macOS

Homebrew users can install an AdoptOpenJDK cask or download the DMG from the AdoptOpenJDK site. The installer will place the JDK in the usual macOS location so tools can find it.

Windows

Grab the MSI for AdoptOpenJDK and run the graphical installer like a responsible desktop user. You can pick system wide installation or a single user install if you lack admin rights.

Installing from archives and common tips

If you have a tar or zip archive extract it into a sensible location such as a standard JVM directory on the platform or a folder under your home directory. Use elevated privileges for system locations or keep it under your user path if you prefer less drama.

Set JAVA_HOME and update PATH

Point JAVA_HOME to the root of the AdoptOpenJDK folder. Add the bin directory to your PATH so java and javac are available in terminals. Persist these lines in your shell profile for Linux and macOS or in Windows system environment settings for a permanent setup.

# bash example
export JAVA_HOME="/path/to/adoptopenjdk"
export PATH="$JAVA_HOME/bin:$PATH"

# verify
java -version
javac -version

Verify the installation

Run java -version and javac -version. The vendor and version should match what you installed. If they do not match then either PATH has an old Java earlier in the chain or JAVA_HOME is pointing at the wrong folder. Fix one of those and take a bow.

Troubleshooting tips that save time

  • If commands still show the wrong Java run which java or where java to find the binary being used.
  • On macOS check /Library/Java/JavaVirtualMachines for installed JDKs.
  • On Windows confirm the system PATH and JAVA_HOME in the Environment Variables dialog instead of relying on the command prompt only.

There you go. You installed AdoptOpenJDK and taught your computer to remember it. Now go write some Java code or at least run a hello world and enjoy the small victory.

I know how you can get Azure Certified, Google Cloud Certified and AWS Certified. It's a cool certification exam simulator site called certificationexams.pro. Check it out, and tell them Cameron sent ya!

This is a dedicated watch page for a single video.