Apache Maven is the most popular project management tool for Java applications. We can install maven on any operating system.
Table of Contents
- 1 Installing Maven on Windows
- 1.1 1. Install JDK on Windows
- 1.2 2. Install Maven on Windows
- 2 References
Installing Maven on Windows
Maven requires JDK to execute. Maven 3.3+ requires JDK 1.7 or above to execute. Let’s look into the various steps to install Maven on Windows.
1. Install JDK on Windows
We can install Oracle JDK using the executable file. But, for this tutorial, we will install OpenJDK. OpenJDK is free to use and we don’t need to worry about licenses or to pay Oracle for support.
1.1) Download OpenJDK Binaries ZIP File
Go to the JDK Download URL: https://jdk.java.net/13/
Download the binaries for Windows/x64 as shown in the below image.
Extract it to any place you want. I have extracted it to
C:\Program Files\Java folder.
1.2) Setting up Environment Variables – JAVA_HOME and Path
We have to set JAVA_HOME and add the JDK binaries folder to the Path variable.
You can search for “edit environment variables” or go to “Control Panel -> System and Security -> System” and click on the “Advanced system settings” link in the left sidebar.
In the “System Properties” popup, go to the “Advanced” tab and click on the “Environment Variables” button. This will open a new popup window to edit user and system environment variables.
Now, create a new system environment variable “JAVA_HOME” with value as the location of the JDK folder.
Also, add the JDK bin folder to the Path variable list of directories.
1.3) Verifying Java Installation through Command Prompt
Open the command prompt and type
java -version command. It should print the JDK version installed by you.
2. Install Maven on Windows
Once the JDK is properly installed and configured, we can move ahead with the installation of the maven.
2.1) Download Maven Binary zip Archive
Go to the URL: https://maven.apache.org/download.cgi
Download the “Binary zip archive” as shown in the below image.
2.2) Setting up Maven Environment Variables – M2_HOME, MAVEN_HOME, Path
First of all, extract the downloaded maven zip file to any folder of your choice. I have extracted it to
Now, use the below image to create the M2_HOME and MAVEN_HOME variables. Also, add the maven bin folder to the Path variable.
2.3) Verifying Maven Installation through Command Prompt
Open command prompt and type
mvn -version command. It should print the maven version, maven bin folder location, and the Java version it’s using.
That’s it. Maven is successfully installed and you can use it to create and manage Java projects.