HowToDoInJava

  • Python
  • Java
  • Spring Boot
  • Dark Mode
Home / Maven / How to install maven on windows

How to install maven on windows

Maven is a build and dependency management tool for Java based application development. Just like other Java based development tools, it is not installed as Windows service, rather it is configured using windows environment variables.

In this maven tutorial, I am installing maven on a Windows 7 32bit machine.

Windows environment variables location:
Control Panel > All Control Panel Items > System > Advanced system settings > Environment Variables

Follow the steps needed to install maven on windows operating system.

Step 1) Install JDK and Add ‘JAVA_HOME’ Environment Variable

To install java, download JDK installer and add/update the JAVA_HOME variable to JDK install folder.

set_java_home_in_windows-3658528

Step 2) Download Maven and add ‘MAVEN_HOME’ and ‘M2_HOME’ Environment Variables

Maven can be downloaded from this location. I have extracted it in location – D:/Latest Setup/apache-maven-3.0.4. You can choose your own location.

Set the M2_HOME and MAVEN_HOME variable to maven installation folder.

set_maven_home-5621308

Step 3) Include ‘maven/bin’ directory in ‘PATH’ variable

To run maven from command prompt, this is necessary. Update the PATH variable with 'Maven-installation/bin' directory.

set_maven_path_variable-7893624

Step 4) Verify maven in console

Maven installation is complete. Now lets test it from windows command prompt.

  1. Go to start menu and type cmd in application location search box.
  2. Press ENTER. A new command prompt will be opened.
  3. Type mvn -version in command prompt and hit ENTER.
$ mvn -version

test_maven_cmd-1566786

This should show the version information of maven installed. If there is any error shown, cross-check all above steps.

In this tutorial, we learned how to install maven on windows.

Happy Learning !!

Was this post helpful?

Let us know if you liked the post. That’s the only way we can improve.
TwitterFacebookLinkedInRedditPocket

About Lokesh Gupta

A family guy with fun loving nature. Love computers, programming and solving everyday problems. Find me on Facebook and Twitter.

Feedback, Discussion and Comments

  1. saurav jain

    November 13, 2019

    Hi, I already have nodejs path in path variable…so What I do for it? I need nodejs path too.
    Please reply asap. Thanks

    • asvin

      December 24, 2019

      just put ; and paste the path

  2. Tanya

    December 27, 2018

    where did M2_HOME variable was set?

    • Kai Wang

      January 18, 2019

      MAVEN_HOME is same as M2_HOME

  3. nikita

    July 27, 2018

    Java and Maven installed properly but “‘mvn’ is not recognized as an internal or external command, operable command or batch file” error occur in cmd.

    • Lokesh Gupta

      July 27, 2018

      Maven /bin folder should be in path environment variable.

      • AndroidDoctorr

        December 27, 2018

        What does this mean?

  4. Asha

    July 25, 2014

    I am not seeing Maven Dependency in Eclipse….any suggestion?

    • Lokesh Gupta

      July 25, 2014

      You will get some help from https://howtodoinjava.com/maven/maven-m2-repo-eclipse/

      Also install maven plugin for eclipse.

  5. bheem

    July 21, 2014

    could not find or load main class org.codehaus.plexus.classworlds. launcher error my system

    I am using Windows 8

    Jdk 8

    • Lokesh Gupta

      July 21, 2014

      maven 2 or maven 3? Try using variable M3_HOME instead of M2_HOME if you are using maven 3.

      • Pooja B Hundekar

        November 25, 2019

        Hi i have downloaded apache-maven-3.6.2 on windows machine and followed same steps still its not working

        • Lokesh Gupta

          November 25, 2019

          Make sure, you verify the maven command in “new command prompt window” if there is already any opened prompt.

  6. Raunak

    April 11, 2014

    Thank you

  7. Tanya

    April 7, 2014

    Excellent Thank you

  8. kaarthik

    November 15, 2013

    thank you… it just took me 5 to 10 minutes to complete it…

  9. Neha Insa

    November 14, 2013

    i enterd maven_home,java_home and path,,bt still not excecute on cmd

    • Lokesh Gupta

      November 14, 2013

      After updating environment variables, open a new command prompt window to test it.

      • Neha Insa

        November 15, 2013

        thanks ,,

  10. Satheesh

    October 14, 2013

    HI , Firstly thanks for your blog n tutorials. Nicely explained How to configure Maven in window environment.

  11. veerachandra

    August 29, 2013

    Hi Lokesh.. U did a grt job for the newbies..
    Thanx a lot πŸ™‚

  12. manoj

    July 23, 2013

    thanx bro its working

  13. Ummer

    June 25, 2013

    Hi Lokesh,
    Its very good article, if you post how to install maven on other OS then its sounds better.

    Thanks

Comments are closed on this article!

Search Tutorials

Maven Tutorial

  • Maven – Installation
  • Maven – Settings
  • Maven – Dependency Mgmt
  • Maven – Dependency Scopes
  • Maven – POM
  • Maven – Parent POM
  • Maven – Repositories
  • Maven – Local Repo Path
  • Maven – M2_REPO
  • Maven – Network Proxy
  • Maven – Enforce Java Versions
  • Maven – Simple Java Project
  • Maven – Web Project
  • Maven – Multi-module Project 1
  • Maven – Multi-module Project 2
  • Maven – Java Source Folders
  • Maven – BOM [Bill Of Materials]
  • Maven – Import Remote Catalogs
  • Maven – Create Custom Archetype
  • Maven – Compiler Level Mismatch
  • Maven – Ant Build
  • Maven – IntelliJ
  • Maven – JSTL Support
  • Maven – Tomcat Plugin
  • Maven – Uber Jar for Spring Boot
  • Maven – Shade Plugin
  • Maven – Remove corrupt jars

Meta Links

  • About Me
  • Contact Us
  • Privacy policy
  • Advertise
  • Guest and Sponsored Posts

Recommended Reading

  • 10 Life Lessons
  • Secure Hash Algorithms
  • How Web Servers work?
  • How Java I/O Works Internally?
  • Best Way to Learn Java
  • Java Best Practices Guide
  • Microservices Tutorial
  • REST API Tutorial
  • How to Start New Blog

Copyright © 2020 · HowToDoInjava.com · All Rights Reserved. | Sitemap

  • Sealed Classes and Interfaces