Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8770193
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T17:30:55+00:00 2026-06-13T17:30:55+00:00

I am installing Maven and need to set M2 and M2_Home. I have set

  • 0

I am installing Maven and need to set M2 and M2_Home. I have set them in the user variables in Environment variables. And I added ;%M2% to the Path variable in the System variables in Environment variables. I was expecting to be able to run mvn --version but I couldn’t. However if I do
echo %Path% I can see that there is %M2% in the Path and if I echo %M2% I can see the bin directory that mvn is in.

So I had this problem. The problem did not get solved until I created a Path variable in user variables and added %M2% to that one (and removed it from the path in System variables). Now it works. Does any one know why it is only working in this specific way?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T17:30:56+00:00Added an answer on June 13, 2026 at 5:30 pm

    You’d have to look at the Windows source code to be certain what’s going on, but this doesn’t surprise me. Based on my testing, it appears that system environment variables can only reference other system environment variables, not user environment variables.

    Note that echo %PATH% should show the expanded path. You shouldn’t see %M2%.

    This is probably because system environment variables sometimes need to be expanded in situations where there is no user context. If user environment variables were included in the expansion of system environment variables this would need to be treated as a special case. It’s also possible that this was considered the preferred behaviour so that a user’s environment variables couldn’t unexpectedly affect the interpretation of system variables, or that there are issues related to the way environment variables are inherited between processes.

    Either add %M2% to the user path as you’ve done, or make M2 a system rather than a user environment variable.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Installing roundcube webmail: I have the DB set up (win serv 2008, MS SQL
I'm new to Maven and Eclipse. We have been using Netbeans and installing jars
I am installing to Maven repository our internal files using mvn install:install command. All
I am getting tired of manually installing javax jar files in Maven and would
When installing git for windows, a user is asked to select from following 3
After installing maven ( mvn -v works fine), I tried to do mvn install
I have a Maven module called display . It is part of a larger
We use maven to build Flex SWF applications. These SWF artifacts have a couple
I have a requirement that I need to run the tests through commandline as
I have an Android Maven project using maven-eclipse-plugin and android-maven-plugin. Since it grabs the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.