You will need Java installed if you want to:
Install Homebrew if it is not installed already:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Then, install Java 8:
brew install openjdk@8
Some macs do not ship java by default, and you will be prompted to install it from java.com. You can ignore it and continue to the next step.
This process is not necessary, but if you would like to uninstall an older version of java that came with your mac, for example, Java 5 or 6, you can use the Java Uninstall Tool provided by Oracle to help uninstall them.
To download the Java installer, go here
Click on the Continue button until you reach the Installation Type page. Here, you can change the installation disk. It is recommended to install java on the same disk as your operating system.