DEV Community

Khairun Nahar Nowrin
Khairun Nahar Nowrin

Posted on

Install Java in macbook M1/M2/M3

Install Homebrew: If you haven't already installed Homebrew, you can do so by opening Terminal and running the following command:
bash

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Enter fullscreen mode Exit fullscreen mode

Install JDK using Homebrew: Once Homebrew is installed, you can install the JDK for ARM-based Macs by running the following command:
bash

brew install --cask temurin
Enter fullscreen mode Exit fullscreen mode

This will install the Temurin JDK, which is compatible with ARM-based Macs.
Verify Installation: After installation, you can verify that Java is installed by running:
bash

java -version
Enter fullscreen mode Exit fullscreen mode

This command should display the version of Java installed on your system.

Top comments (0)