I am having a very weird issue with Windows 7, and I'd like ideas. I appear to be having some sort of sync issue with my environment variables.
So I recently changed from Apache Maven 3.0.5 to 3.0.3 (work required it).
The previous maven folder was located at:
C:\...\apache-maven-3.0.5
The new one is located in the same place, and 3.0.5 version was deleted:
C:\...\apache-maven-3.0.3
Maven requires 2 environment variables to be set: a M2_HOME variable, and then an added PATH variable: M2_HOME\bin
I adjusted my M2_HOME variable accordingly, and left the PATH variable alone, since it is just referencing the M2_HOME.
Ok, so when I log into my computer, if I open a command prompt and type:
mvn -version
I get the standard:
'mvn' is not recognized as an internal or external command, operable program or batch file.
If I then type:
echo %M2_HOME%
It replies with the new correct directory:
C:\...\apache-maven-3.0.3
If I then check my PATH variable:
echo %PATH%
It prints (among the rest of the paths) the OLD and non-existent maven folder:
C:\...\apache-maven-3.0.5\bin
And as if that all wasn't weird enough, to "fix" the problem, all I have to do is go to my environment variables, open the edit for the PATH variable, and then immediately close it without changing or saving anything. After I do that, my echo of the PATH variable is suddenly correct:
C:\...\apache-maven-3.0.3\bin
And everything works properly.
Another solution is opening up the command prompt in Administrator mode. If I do an echo of the PATH variable then, I get the correct variable:
C:\...\apache-maven-3.0.3\bin
If I then open the command prompt normally (not in Admin mode), it is still in its "broken" state.
To revert the PATH variable back to its broken state, all I have to do is log out of my account, and then log back in (no need to even turn the pc off, just logging out does it).
Does anyone have a clue what the heck is going on here?