Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to brew install java?

I'd like to setup java on a new OS X machine, and prefer to use brew for OS X package management. How can I install latest java using brew?

like image 276
Tim Fulmer Avatar asked Jan 06 '21 18:01

Tim Fulmer


People also ask

How do I install a different version of Java in Brew?

If not, you can install it via: $ brew tap homebrew/cask-versions $ brew update $ brew tap caskroom/cask To install previous or specific versions of JDKs, you can get them from AdoptOpenJDK: If you want to switch between different versions of Java, you need to add the following to your .bash_profile.

How do I update Homebrew to Java 10?

Update HomeBrew. 2. Add the casks tap. 3. Install a specific version of the JDK such as java8, java10 or java for the current. Add the following aliases to .bash_profile. Reload .bash_profile for the aliases to take effect.

How do I install Java on JenV?

But, Jenv doesn't install Java for you. Use your platform appropriate package manager to install Java. On macOS, brew is recommended. First, ensure that you have Homebrew installed in your system. Homebrew is a package manager for Mac OS. So if you want to learn more details about it, visit my blog below.

How to install&uninstall Java on Mac OS X?

Use HomeBrew To Install & Uninstall Java On Mac OS X. 1.1 Use HomeBrew Cask Command To Install Java JDK. Install HomeBrew on your mac os, please read the article How To Install HomeBrew On Mac OS. Run the below command to install the homebrew cask extension, cask extension tool can help you to install and manage software packages easily.


1 Answers

Turns out java has been moved into brew core recently, so the correct command as of January 2021 is:

brew install java

Don't be like me and follow old instructions to install from cask, it will not work. You will get an error message from brew like this:

% brew install --cask java
Error: Cask 'java' is unavailable: No Cask with this name exists.

You may also see this:

% brew cask install java
Error: Calling brew cask install is disabled! Use brew install [--cask] instead.
like image 162
Tim Fulmer Avatar answered Sep 18 '22 18:09

Tim Fulmer