Install Java on MacOS
Installing Java basically involves downloading,
installing, and verifying the Java version.
Follow the steps below to install Java on MacOS:
The new Oracle policy requires you to have an Oracle
account before you can download Oracle Java. If you
do not already have an Oracle account then you can
Create a new Oracle Account here. After creating an Oracle account, verify your email.
Go to the official Oracle
Java 8 download page. Find other Java JDK version
Look for macOS x64 and click on the corresponding
.dmg file download link on the right.
Next, accept the license agreement and then click on
the download button.
You'll be redirected to the oracle login page.
Signin into your Oracle account. When the download
dialog box appears prompting you to run or save the
file, save the file to install it later.
After you have downloaded the .dmg file, navigate to
the location where your file is downloaded. Double
click on the saved file and follow the installation
wizard until it is complete.
Verify Java Installation
After the installation is complete, verify the Java
version that is installed on your computer by
running the following command in the terminal:
This displays the current version of Java that is
installed on your computer as shown in the example
Next, you can verify the installed java compiler
version by running the following command in the
java version "13.0.2_231"
Java(TM) SE Runtime Environment (build 13.0.2_231-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.231-b11, mixed mode)
Running the above command should display the current
version of Java compiler that is installed on your
Installation of Oracle Java is complete.