Use Homebrew to install JDK on macOS

in #programming6 years ago

Something you need to know before you read this article


  • What is Homebrew?

Homebrew is a package manager for macOS.

  • How can I install Homebrew?

Just open your terminal application , paste the following command ,and press enter.
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Why should I install JDK in this way?


  • Easy to install
    You don’t have to waste time to search jdk , download it , click something to install it. One command is all you need, then the only thing you need to do is wait :)
  • Easy to uninstall
    There is another benefit you can get from this way, that ’s when you want to uninstall it, you don’t have to google how to uninstall jdk and spend some time finding which file is need to be deleted.Yeah,it also just required one command , then you can take a rest :)
  • Easy to install different version
    No matter you want to install the latest JDK , or something like JDK7 or JDK8,you can do it by just two commands.

Let’s do it!


  • Install the latest JDK

brew cask install java
(you can also check the information of JDK by enter brew cask info java)

  • Uninstall JDK

brew cask uninstall java

  • Install different versions of JDK

brew tap caskroom/versions
brew cask install java8 (Or other version if you want)

Check if you successfully installed it


Enter java -version,if you see something like the following picture, congratulations, you have installed the JDK successfully.jdk.png

The End


Avatar
If you like my post , don’t forget to follow me and upvote :)

Sort:  

This post has received a 1.36 % upvote from @booster thanks to: @blue.star.

You got a 4.68% upvote from @upmewhale courtesy of @blue.star!

Earn 100% earning payout by delegating SP to @upmewhale. Visit http://www.upmewhale.com for details!

Congratulations @blue.star! You received a personal award!

Happy Birthday! - You are on the Steem blockchain for 1 year!

You can view your badges on your Steem Board and compare to others on the Steem Ranking

Vote for @Steemitboard as a witness to get one more award and increased upvotes!