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 Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones AWS Cloud
by AWS Developer Relations
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones
AWS Cloud
by AWS Developer Relations
  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.

Prashanth Belathur user avatar by
Prashanth Belathur
·
Oct. 16, 18 · Code Snippet
Like (3)
Save
Tweet
Share
102.15K 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.

Popular on DZone

  • Java REST API Frameworks
  • HTTP vs Messaging for Microservices Communications
  • DevOps vs Agile: Which Approach Will Win the Battle for Efficiency?
  • Tracking Software Architecture Decisions

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

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

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends: