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

  • Designing a Polling Pipeline for Rate-Limited APIs Without Losing Data
  • Agent Harness, Memory Indexing, and AI Governance in Test Automation
  • How to Hide Sensitive Information Before You Share a File
  • Two AI Agents, One Database: Solving Concurrent Updates With Optimistic Locking

Draft This article hasn't been published, so readers can't see it.

In moderation This article is waiting for review, so readers can't see it yet.

Deleted This article has been deleted, so readers can't see it.

  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
·
Updated Oct. 16, 18 · Code Snippet
Post on X (opens in a new tab) Share on LinkedIn (opens in a new tab)
105.5K Views

Join the DZone community Save articles, join the discussion, and download Refcards and Trend Reports with a free account.

Join for free Already a member? Log in

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

Loading comments

The comments didn't load

Please try again in a moment.

Likes

Loading

The next likes didn't load. Please try again.

The likes didn't load

Please try again in a moment.

See who liked this

Log in or join DZone for free to see who liked this article.

Log in Join for free
  • 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