UPDATE: Now that Java 8 is no longer the most current version, we need to install it. brew search jdk (shows both AdoptOpenJDK and the Oracle JDK)Īccording to this article, newer versions of Java JDK from Oracle are under GPL v2 license with a Classpath exception (they seemed to link to the same page on the non- https site). To get a list of all older versions of java: brew cask search java.To install most recent OpenJDK version from : brew cask install java # (*may* need a password to succeed) brew -prefix -installed is a new flag to brew -prefix that will fail. Fixed a bug where brew update could be run every time.
To install OpenJDK 11 from : brew cask install java11 # (*may* need a password to succeed) brew casks is a new command implemented in Bash to speedily output all casks available to install (like brew formulae) brew info -cask -jsonv2 includes whether a cask is outdated and the currently installed versions. To install latest version of OpenJDK from AdoptOpenJDK: brew tap adoptopenjdk/openjdk # (if not already added)īrew cask install adoptopenjdk # (*may* need a password to succeed)Īlternative installation of OpenJDK from - with no AdoptOpenJDK tap needed: The following commands show both JDK versions installed:
This answer assumes that a recent version of Homebrew is installed, with brew cask install enabled and working.Īt this point, assuming that no newer version of Java or Java JDK is installed, java -version shows me openjdk version "11.0.3" and javac -version shows me javac 11.0.3 (with no JAVA_HOME environment variable in use). To stay with a specific major release, activate the AdoptOpenJDK tap with brew tap and then install the desired version with brew install -caskNote that OpenJDK as used by AdoptOpenJDK is open source under GPL v2 license with a Classpath exception. Recommended commands to install OpenJDK 11 from AdoptOpenJDK (with notes after the # sign) : brew tap adoptopenjdk/openjdk # assuming this tap was not already addedīrew cask install adoptopenjdk11 # this command *may* need a password to succeed