0

I have so many problems with installing apache maven. I have tried lot of instructions from youtube and from StackOverflow as well but none of these solutions is the right one. So in system variables I have the following

JAVA_HOME
C:\Program Files\Java\jdk1.8.0_111

M2
%M2_HOME%\bin

M2_HOME
C:\Program Files\Apache Software Foundation\apache-maven-3.3.9

Path
%M2%

If I type in command line javac it's working fine, but when I type mvn --version I have an error

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

Any suggestions? Thank you!

jediz
  • 4,459
  • 5
  • 36
  • 41
Norby
  • 321
  • 1
  • 4
  • 13
  • You probably need quotes around your `M2_HOME` variable... But you do not need that environment variable to begin with, just set the `PATH` to the correct value. – Tunaki Dec 04 '16 at 23:23
  • I've deleted M2 variable and in Path variable I have changed to %M2_HOME%\bin but still same. – Norby Dec 04 '16 at 23:32
  • Did you add the quotes? You should just have `PATH` contain `"C:\Program Files\Apache Software Foundation\apache-maven-3.3.9\bin"` without any `M2` or `M2_HOME` and with quotes. – Tunaki Dec 04 '16 at 23:33
  • Yep with quotes I'm getting error message from command line "Files\Apache was unexpected at this time." Withouth M2 and M2_Home is same :( – Norby Dec 04 '16 at 23:35
  • read the maven start script *mvn.cmd* under *bin* and locate where the problem turn up. – nail fei Dec 05 '16 at 01:12
  • 1
    Did you look at [this question](http://stackoverflow.com/questions/11118237/maven-error-could-not-find-or-load-main-class-org-codehaus-plexus-classworlds-l)? It seems very similar to yours. – 31piy Dec 05 '16 at 17:30
  • @31piy thanks for link, I've found solution from this link. So solution here was to download and unpackage file apache-maven-3.3.9-bin.tar.gz, rather than apache-maven-3.3.9-bin.zip as proposed from offical instructions. Cheers! – Norby Dec 05 '16 at 21:01
  • by the way, your question title is pretty vague – jediz Dec 06 '16 at 09:05

1 Answers1

0

My fix for "Files\Apache was unexpected at this time." was to remove the quotes around the path when setting JAVA_HOME. Just run: set JAVA_HOME=C:\Program Files\Java\jdk1.8.0_111, no quotes.

jediz
  • 4,459
  • 5
  • 36
  • 41
zircon
  • 1