DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Related

  • Java Developers, Don't Throw Out Your Mac Yet: Apple Will Contribute To OpenJDK
  • Java Development Trends 2023
  • Binary Code Verification in Open Source World
  • Hack OpenJDK with NetBeans IDE

Trending

  • Improving Java Application Reliability with Dynatrace AI Engine
  • Manual Investigation: The Hidden Bottleneck in Incident Response
  • Stop Poisoning Your Models: How I Built a CV Dataset Quality Toolkit I Can Reuse Forever
  • Setting Up Claude Code With Ollama: A Guide
  1. DZone
  2. Coding
  3. Java
  4. Installing OpenJDK Versions on Macs

Installing OpenJDK Versions on Macs

Take a look at how you can quickly get started with OpenJDK with this tutorial that gives you commands for installing version 7-11 through a Mac Terminal.

By 
Prashanth Belathur user avatar
Prashanth Belathur
·
Updated Oct. 16, 18 · Code Snippet
Likes (3)
Comment
Save
Tweet
Share
105.2K Views

Join the DZone community and get the full member experience.

Join For Free

In this article, I will be using Homebrew to install OpenJDK versions on the Mac.

We use brew install to install JDK versions 8,9,10, and brew cask install for version 11 and above.             

All the brew commands are executed in the Terminal window on the Mac.

Install OpenJDK Versions 8, 9, and 10

brew tap AdoptOpenJDK/openjdk 

==> Tapping adoptopenjdk/openjdk

Cloning into '/usr/local/Homebrew/Library/Taps/adoptopenjdk/homebrew-openjdk'...
remote: Enumerating objects: 8, done.
remote: Counting objects: 100% (8/8), done.
remote: Compressing objects: 100% (7/7), done.
remote: Total 8 (delta 2), reused 2 (delta 0), pack-reused 0
Unpacking objects: 100% (8/8), done.
Tapped 3 formulae (36 files, 29.4KB).


brew search /adoptopenjdk/ 

==> Formulae

adoptopenjdk/openjdk/adoptopenjdk-openjdk10    
adoptopenjdk/openjdk/adoptopenjdk-openjdk9
adoptopenjdk/openjdk/adoptopenjdk-openjdk8

==> Casks
adoptopenjdk

The Formulae section contains the identifiers for the various JDK versions.

To install a specific JDK version: brew install <identifier> 

e.g. to install OpenJDK 8:  brew install adoptopenjdk/openjdk/adoptopenjdk-openjdk8 

==> Installing adoptopenjdk-openjdk8 from adoptopenjdk/openjdk
==> Downloading https://github.com/AdoptOpenJDK/openjdk8-releases/releases/download/jdk8u172-
==> Downloading from https://github-production-release-asset-2e65be.s3.amazonaws.com/85294734
######################################################################## 100.0%

Warning: This brew TAP is being DEPRECATED soon in favour of using brew cask. 
Please check out https://github.com/AdoptOpenJDK/homebrew-openjdk/blob/master/README.md for more info
/usr/local/Cellar/adoptopenjdk-openjdk8/jdk8u172-b11: 577 files, 170.4MB, built in 40 seconds

JAVA_HOME should be set by the developer to /usr/local/Cellar/adoptopenjdk-openjdk8/jdk8u172-b11. 

Install OpenJDK Version 11

brew cask install adoptopenjdk

[~] > brew cask install adoptopenjdk
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 1 tap (homebrew/cask).
No changes to formulae.

==> Satisfying dependencies
==> Downloading https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-11%2B28/Open
Already downloaded: /Users/pbelathur/Library/Caches/Homebrew/downloads/154143ed1f7540b66ebceb732063de00c27467a5796256bea5e4492690833116--OpenJDK11-jdk_x64_mac_hotspot_11_28.tar.gz
==> Verifying SHA-256 checksum for Cask 'adoptopenjdk'.
==> Installing Cask adoptopenjdk
Password:
adoptopenjdk was successfully installed!

JAVA_HOME should be set by the developer to /Library/Java/JavaVirtualMachines/adoptopenjdk-11.jdk. 

OpenJDK

Opinions expressed by DZone contributors are their own.

Related

  • Java Developers, Don't Throw Out Your Mac Yet: Apple Will Contribute To OpenJDK
  • Java Development Trends 2023
  • Binary Code Verification in Open Source World
  • Hack OpenJDK with NetBeans IDE

Partner Resources

×

Comments

The likes didn't load as expected. Please refresh the page and try again.

  • RSS
  • X
  • Facebook

ABOUT US

  • About DZone
  • Support and feedback
  • Community research

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 215
  • Nashville, TN 37211
  • [email protected]

Let's be friends:

  • RSS
  • X
  • Facebook