Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to install specific Java version using Homebrew?

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.

like image 562
icodes Avatar asked Jun 19 '17 13:06

icodes


People also ask

How do I install specific versions of Java on Mac?

I just tried again, it's working fine, please follow the steps, you need to run "brew tap caskroom/versions" first. As instructed by homebrew, the command that worked for me was brew cask install caskroom/versions/java8 First I ran brew cask uninstall java to remove the other version I had previously installed.

How do I change Java to 1.8 on Mac?

We use the export command with the variable name next to it and then specify the location of usr/libexec/java_home with the argument -v and the version we want to change to 1.8. Note that backticks are being used around the path. Check the Java version again to confirm that the version was changed.


1 Answers

  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 info --cask java8

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

brew install --cask java8

like image 120
Jubba Smail Avatar answered Oct 04 '22 15:10

Jubba Smail