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.
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.
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.
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.
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.
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.
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
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.
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.