DEV Community

Cover image for Setting Up Java & Maven for Spring Boot – Step-by-Step Guide
Tejas Agravat
Tejas Agravat

Posted on

Setting Up Java & Maven for Spring Boot – Step-by-Step Guide

Introduction

Before starting with Maven or Spring Boot, we need to set up the basic development environment. This includes installing Java (JDK) and Apache Maven.

Canonical Link

Original Hashnode Post


☕ Step 1: Install Java (JDK)

Java is required to compile and run Java applications.

Download Java

Install Java 17 (LTS) (recommended). You can choose OpenJDK / Temurin or Oracle JDK.

Java JDK 17 download link: Sign in to Oracle India and download it.

Windows Installation

  1. Download the .exe installer
  2. Run the installer and follow the steps
  3. Note the installation path (example):

Set JAVA_HOME

Windows:

  • Create a system variable:
  JAVA_HOME = C:\Program Files\Java\jdk-17 

Enter fullscreen mode Exit fullscreen mode

  • Add to Path:
%JAVA_HOME%\bin

Enter fullscreen mode Exit fullscreen mode

Verify Java Installation

java -version
javac -version

Enter fullscreen mode Exit fullscreen mode

📦 Step 2: Install Apache Maven

Download Apache Maven 3.9.x (Binary zip) from official site
Apache Maven Download Link

Windows Installation

1 Extract the zip file Example:

 C:\Program Files\Apache\maven

Enter fullscreen mode Exit fullscreen mode

2 Folder structure should include:

 bin
 conf
 lib

Enter fullscreen mode Exit fullscreen mode

Set MAVEN_HOME

Windows

  • Create system variable:
  MAVEN_HOME = C:\Program Files\Apache\maven
Enter fullscreen mode Exit fullscreen mode

  • Add to Path:
  %MAVEN_HOME%\bin

Enter fullscreen mode Exit fullscreen mode

Verify Maven Installation

mvn -version

Enter fullscreen mode Exit fullscreen mode

Expected output:

Apache Maven 3.9.x
Java version: 17

Enter fullscreen mode Exit fullscreen mode

⚠️ Common Installation Issues

Issue Fix
java not recognized Check JAVA_HOME
mvn not recognized Check MAVEN_HOME
Wrong Java version Restart terminal / IDE

✅ Conclusion

After completing these installation steps:

-Java is ready to compile code

-Maven is ready to build projects

-You can now create and run Maven-based Java applications

🚀 What’s Next?

Now that the development environment is ready with Java and Maven, the next steps focus on building a strong foundation before moving into Spring Boot.

Let’s Connect!

LinkedIn Github

If you have any recommended resources, better approaches to my challenges, or insights, I’d love to hear them! Drop your thoughts in the comments.

Have a wonderful day!

Top comments (0)