Installing a specific version of Java on my Macbook Pro

Balkrishna Pandey
2 min readSep 14, 2021

I hardly write on Medium these days, follow me on goglides.dev

As the title said, this is merely a placeholder for information that I may require in the future. On the internet, there are several articles on this subject. However, I have to use Google to make it work every time, which is odd. I can’t just recall the information or locate the appropriate articles without first skimming through a few.

Some information

brew --version
Homebrew 3.2.11-163-gf14fcc8
Homebrew/homebrew-core (git revision a3d1c526759; last commit 2021-09-14)
Homebrew/homebrew-cask (git revision 51f858fec1; last commit 2021-09-14)

Install with HomeBrew

  1. Update HomeBrew.

brew update

2. Add the casks tap.

$ brew tap homebrew/cask-versions

3. Install a specified JDK version, such as java8, java11, or java.

$ brew install java11

Follow the steps so that you can find it later,

For the system Java wrappers to find this JDK, symlink it with
sudo ln -sfn /usr/local/opt/openjdk@11/libexec/openjdk.jdk /Library/Java/JavaVirtualMachines/openjdk-11.jdk

--

--