Setting up your development environment for JAVA with Maven — Windows Edition
In this blog post, I will walk you through configuring your development machine for JAVA development using Apache Maven on Windows.
By the end of this guide, you will be able to start working on JAVA projects with Apache Maven on Windows.
If you are running macOS or Linux, please see the following posts regarding those Operating Systems:
macOS Edition
Linux Edition
Also see this article for the Hardware Requirements, and Prerequisites:
Setting up your development environment for JAVA with Maven
Software Installation
JetBrains IntelliJ
Download the .exe package and follow the installation wizard instructions
Read the instructions and click Next to continue
Verify or Modify the installation path for IntelliJ and click on Next
Specify installation options to your preference. I would recommend selecting all of the Associations and add the PATH variable
Choose the Start Menu Folder for IntelliJ and click on Install
Wait until the software installed successfully
Complete the installation by rebooting your machine
JAVA
Open the installer file and the file will start to extract the required files onto the machine
Read the instructions and click on Next
Verify or Modify the installation path of JAVA and click Next
Installation starting
Updating the components of the installer
Installer copying files over to machine
Installation complete. Click on Close
Set Environment Variables for JAVA by right clicking on the Windows Start Button and navigate to System
On the right side of your Settings, find the Related settings section and select Advance system settings
Ensure you are on the Advanced tab of the window, and navigate to the bottom of the screen and click the Environment Variables button
Add a new User Variable for JAVA with the path you installed JAVA to earlier
Select the Path User Variable for your user and edit the Path record
Add a new path record pointing to the bin folder of your JAVA installation, click OK to continue and click OK on the Environment Variables window and click OK and the System Properties window
Apache Maven
To install Maven on Windows 10, ensure JAVA_HOME is set by running the following command
echo %JAVA_HOME%
Verify the above command returns a proper value. If nothing is returned, verify the Java JDK is installed on your system. JDK 21 is needed for the Maven.
Download the binary zip archive from the publisher’s website
https://maven.apache.org/download.cgi
Extract the archive to a suitable location, I prefer to store all my automation tools in a dedicated directory
Add the bin directory of the extracted Maven directory to the PATH environment variable.
Set Environment Variables for Maven by right click on the Windows Start Button and navigate to System
On the right side of your Settings, find the Related settings section and select Advance system settings
Ensure you are on the Advanced tab of the window, and navigate to the bottom of the screen and click the Environment Variables button
Add a new User Variable for Maven with the path you copied / extracted Maven to earlier
Select the Path User Variable for your user and edit the Path record
Add a new path record pointing to the bin folder of your Maven folder, click OK to continue and click OK on the Environment Variables window and click OK and the System Properties window
Software Verification
IntelliJ IDEA
Confirm that IntelliJ IDEA or IntelliJ IDEA Community Edition have entries under the User variables for your user
JAVA
To verify the Java JDK is properly installed, from your command line run the following command:
java -version
This command verifies the Java (java) is installed. If java is not found, check your Java installation.
JAVA JDK
To verify the Java JDK is properly installed, from your command line run the following command:
javac -version
This command verifies the Java complier (javac) is installed. If javac is not found, check your Java JDK installation.
Maven will not function without JAVA properly installed.
Apache Maven
To verify the Apache Maven is properly installed, from your command line run the following command:
mvn -v
or
mvn -version
This command verifies Apache Maven is installed. If Maven is not found, check your Maven User Variables