How to install specific Java version using Homebrew?

icodes :

I am looking to install Java on Mac using Homebrew. This works fine using the command brew cask install java.This installs the latest stable version which is currently - 1.8.0_141 However how can I install a specific version for example 1.8.0_131.

Jubba Smail :
  1. Install homebrew

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

  1. Update homebrew if already installed:

brew update

  1. allow brew to lookup versions

brew tap homebrew/cask-versions

  1. list available java versions

brew search java

Optional: to find out the minor version of java

brew cask info java8

  1. install java 8 (or any other version available)

brew cask install java8

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=425788&siteId=1