How to Install Java in MacOS
Step 1: Install Homebrew
If you don’t have Homebrew installed on your macOS, you can install it by opening Terminal and executing the following command:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Step 2: Install java
Once Homebrew is installed, you can use it to install Java by running the following command in Terminal:
brew install openjdk
Homebrew will automatically download and install JAVA and its dependencies. The process may take a few minutes, depending on your internet connection speed.
Step 3: Verify Installation
After the installation is complete, you can verify if JAVA is installed correctly by running the following command:
java -version
$ java -version
openjdk version "21.0.1" 2023-10-17
OpenJDK Runtime Environment Homebrew (build 21.0.1)
OpenJDK 64-Bit Server VM Homebrew (build 21.0.1, mixed mode, sharing)
Please share the Page if it helps.
No comments