To get Java on a Mac, the basic command to run is
> brew cask install adoptopenjdk
This will install the latest “brew” version at /Library/Java/JavaVirtualMachines/adoptopenjdk-xx.jdk
For me, it was version 14.
To uninstall it, just change install to “un”install.
To install a specific version of Java, run:
> brew cask install adoptopenjdk8
You should get this output:
Mac:bin sean$ brew cask install adoptopenjdk8 Updating Homebrew... ==> Auto-updated Homebrew! Updated 1 tap (homebrew/core). ==> Updated Formulae metabase mill ==> Downloading https://github.com/AdoptOpenJDK/openjdk8-binaries/releases/download/jdk8u252-b09.1/OpenJDK8U-jdk_x64_mac_hotspot_8u252b09.pkg ==> Downloading from https://github-production-release-asset-2e65be.s3.amazonaws.com/140418865/34d94500-8491-11ea-812f-81222eb98fec?X-Amz-Algo ######################################################################## 100.0 ==> Verifying SHA-256 checksum for Cask 'adoptopenjdk8' ==> Installing Cask adoptopenjdk ==> Running installer for adoptopenjdk8; your password may be necessary ==> Package installers may write to any location; options such as --appdir are ignored installer: Package name is AdoptOpenJDK installer: Installing at base path / installer: The install was successful. package-id: net.adoptopenjdk.8.jdk version: 1.8.0_252-b09 volume: / location: Library/Java/JavaVirtualMachines/adoptopenjdk-8.jd install-time: 1587687358 🍺 adoptopenjdk8 was successfully installed!