0

I have a git-bash installed on windows 10. Maven command doesn't work. When running mvn --version the output is:

Error: Could not find or load main class org.codehaus.plexus.classworlds.launcher.Launcher

Maven is working in the regular windows command and in the intellij. Moreover git-bash does recognize the location of maven and gives an accurate answer to which mvn steps I've taken to try to resolve the issue with no success:

  • removed the M2_HOME definition which was suggested here
  • created a .bashrc and .bash_profile files with export command similar to `export PATH=/usr/local/apache-maven-3.x.y/bin:$PATH'
  • reinstalled MAVEN a couple of times.

my JAVA_HOME is defined as C:\Program Files\Java\jdk1.8.0_261

Itamar Lev
  • 84
  • 5
  • The problem seems to be with the location of Java However I couldn't solve it... As a workaround I've enabled Windows Subsystem for Linux (WSL) and installed Ubuntu. In the Ubuntu I have installed JDK and Maven. all works perfectly. – Itamar Lev Nov 18 '20 at 09:33

1 Answers1

0

For the maven command to work on my machine, I had to add the maven\bin directory which hosts maven executables in my window environment variables.
C:\apache-maven-3.6.3\bin I had put there M2_HOME and the full apache-maven directory but without success