DEV Community

Rafli Putra
Rafli Putra

Posted on

2

Step-by-Step Guide: Installing Java JDK and Maven on a Mac using Homebrew

Java is a programming language that is widely used for developing applications, and Maven is a build tool that helps manage the dependencies and build process of your Java projects. In this post, I'll walk you through the process of installing the latest version of Java and Maven on a Mac using Homebrew.

Step 1: Install Homebrew

The first step is to install Homebrew. If you don't have it installed, open the terminal and enter the following command:

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

Step 2: Install Java

Once Homebrew is installed, you can use it to install Java. To install the latest version of Java, enter the following command in the terminal:

$ brew cask install java
$ brew cask install maven
Enter fullscreen mode Exit fullscreen mode

Step 3: Verify the Java Installation

Once the installation process is finished, ensure the installation is completed successfully with the following command:

Java:
$ java -version
Enter fullscreen mode Exit fullscreen mode

Here is an example output of successful Java installation:

openjdk version "15.0.1" 2020-10-20
OpenJDK Runtime Environment (build 15.0.1+9)
OpenJDK 64-Bit Server VM (build 15.0.1+9, mixed mode, sharing)

Maven:
$ mvn -v
Enter fullscreen mode Exit fullscreen mode

Here is an example output of successful Maven installation:

Apache Maven 3.8.1 (05c21c65bdfed0f71a2f2ada8b84da59348c4c5d)
Maven home: /Users/rafliputraa/apache-maven-3.8.1
Java version: 15, vendor: Oracle Corporation, runtime: /Library/Java/JavaVirtualMachines/jdk-15.jdk/Contents/Home
Default locale: en_ID, platform encoding: UTF-8
OS name: "mac os x", version: "10.16", arch: "x86_64", family: "mac"

Heroku

Build apps, not infrastructure.

Dealing with servers, hardware, and infrastructure can take up your valuable time. Discover the benefits of Heroku, the PaaS of choice for developers since 2007.

Visit Site

Top comments (0)

nextjs tutorial video

Youtube Tutorial Series 📺

So you built a Next.js app, but you need a clear view of the entire operation flow to be able to identify performance bottlenecks before you launch. But how do you get started? Get the essentials on tracing for Next.js from @nikolovlazar in this video series 👀

Watch the Youtube series

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay