Skip to main content

Command Palette

Search for a command to run...

🚀 How to Install Java (JDK) and Maven on Windows 10/11 – Step by Step

Updated
3 min read

Java is one of the most popular programming languages, and Maven is a powerful build automation tool used for Java projects. In this tutorial, I’ll show you how to install Java JDK and Apache Maven on a Windows machine from scratch.


🔹 Step 1: Check Existing Java Installation

Before installing, check if Java is already installed:

java -version
javac -version
  • If Java is installed, you’ll see something like:
java version "1.8.0_121"
javac 11.0.16.1

⚠️ If the versions don’t match (e.g., JRE is Java 8, but javac is Java 11), it’s recommended to update to the latest version.


🔹 Step 2: Download Java JDK

  1. Go to the official Oracle JDK download page: Oracle Java Downloads

  2. Find the latest Java SE Development Kit (JDK). Example: Java 25 LTS.

  3. Under Windows, download the x64 Installer (.exe).


🔹 Step 3: Install Java JDK

  1. Double-click the downloaded installer.
  2. Follow the setup wizard:

    • Keep the default installation path (e.g., C:\Program Files\Java\jdk-25).
    • Click Next and Finish when installation completes.

🔹 Step 4: Set JAVA_HOME and Update PATH

  1. Press Win + S → type Environment Variables → open Edit the system environment variables → click Environment Variables.

  2. Create JAVA_HOME

    • Click New under System variables.
    • Variable name: JAVA_HOME
    • Variable value: C:\Program Files\Java\jdk-25
  3. Add to PATH

    • Select PathEditNew%JAVA_HOME%\bin
    • Move it to the top to take priority.
  4. Click OK to save.


🔹 Step 5: Verify Java Installation

Open a new Command Prompt and type:

echo %JAVA_HOME%
java -version
javac -version

Expected output:

C:\Program Files\Java\jdk-25
java version "25" 2025-09-16 LTS
javac 25

✅ This confirms Java is correctly installed and configured.


🔹 Step 6: Download Apache Maven

  1. Go to the official Apache Maven download page: Apache Maven Downloads

  2. Download the Binary zip archive of the latest version. Example: apache-maven-3.9.11-bin.zip

  3. Extract it to a folder, for example:

C:\Maven\apache-maven-3.9.11

🔹 Step 7: Set M2_HOME and Add Maven to PATH

  1. Open Environment Variables again.

  2. Create M2_HOME

    • Click New under System variables.
    • Variable name: M2_HOME
    • Variable value: C:\Maven\apache-maven-3.9.11
  3. Add Maven to PATH

    • Select PathEditNew%M2_HOME%\bin
    • Move it to the top.
  4. Click OK to save.


🔹 Step 8: Verify Maven Installation

Open a new Command Prompt and run:

mvn -version

Expected output:

Apache Maven 3.9.11 (xxxx)
Maven home: C:\Maven\apache-maven-3.9.11
Java version: 25, vendor: Oracle Corporation
Java home: C:\Program Files\Java\jdk-25

✅ Maven is installed and correctly using your Java setup.


🔹 Summary Table of Installed Versions

ToolVersion
Java25 LTS
Javac25
Maven3.9.11

✅ Conclusion

You now have Java JDK 25 and Apache Maven 3.9.11 installed and fully configured on Windows.

Your system is ready for Java development, building projects, and running Maven-based applications.

💡 Tips:

  • Always use the latest LTS version of Java for production projects.
  • Keep JAVA_HOME and M2_HOME updated when upgrading.
  • Using Maven with Java 25 ensures compatibility with modern libraries and frameworks.

More from this blog

Vinay206

10 posts