Reputation: 105
I have just installed new Maven into my new Fedora 17 64bit.
Details:
java -version
java version "1.6.0_32"
Java(TM) SE Runtime Environment (build 1.6.0_32-b05)
Java HotSpot(TM) 64-Bit Server VM (build 20.7-b02, mixed mode)
javac -version
javac 1.6.0_32
echo $JAVA_HOME
/usr/java/jdk1.6.0_32
echo $JRE_HOME
/usr/java/jdk1.6.0_32/jre
echo $M2_HOME
/usr/local/maven/apache-maven-3.0.4
echo $M2
/usr/local/maven/apache-maven-3.0.4/bin
echo $PATH
/usr/local/maven/apache-maven-3.0.4/bin:/usr/local/bin:/usr/bin:/bin:/usr/games:/usr/local/sbin:/usr/sbin:/usr/java/jdk1.6.0_32/bin:/home/bujaka/.local/bin:/home/bujaka/bin
which mvn
/usr/local/maven/apache-maven-3.0.4/bin/mvn
But mvn -version throws java.lang.ClassNotFoundException.
java.lang.ClassNotFoundException: org.apache.maven.cli.MavenCli
at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:50)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:244)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:230)
at org.codehaus.plexus.classworlds.launcher.Launcher.getMainClass(Launcher.java:145)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:267)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
P.S. I installed maven from apache site (not from fedora repos)
Upvotes: 2
Views: 12901
Reputation: 1
I had the same issue in my Windows where tried to install the latest maven version and it cause the same class not found
exception. I suspect it had something to do with a dependency missing from the /lib
directory. I had to install the previous stable release instead of the latest release and that solved the issue for me.
Upvotes: 0
Reputation: 167
Best solution for this issue: Go to maven official site i.e https://maven.apache.org/download.cgi and download latest Apache maven. (Make sure you download Binary zip archive for windows user specially)
and set SYSTEM environment variable as:
MAVEN_HOME C:\Program Files (x86)\apache-maven-3.8.6
path %MAVEN_HOME%\bin
Upvotes: 0
Reputation: 8264
I just came across this same issue. Bujaka's comment and Peter Butkovic's answer get at the issue, but for the record here's my take on it and the solution I used.
I don't know what causes this, but sometimes the entire content of the /lib folder in your maven installation directory can become empty. This may be the case when you get this error.
If you check your /lib folder and find that it is not empty, it is still possible (although unlikely) that a crucial file somehow got deleted.
If your maven installation used to work find and only started acting up recently, then the zipped archive you used was probably fine. Here's what to do:
Your maven installation should now work again.
Upvotes: 1
Reputation: 12139
thanks user1436170
, your last comment did the job for me as well:
/lib catalog was empty in maven.tar.gz archive.
When opening via krusader, lib folder in tar.gz file it was empty, but it contains jars when opening via ark.
Anyway zip works.
Upvotes: 4
Reputation: 443
MavenCli class is in maven-embedder. Are you behind a proxy?
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
http://maven.apache.org/xsd/settings-1.0.0.xsd">
...
<proxies>
<proxy>
<id>myproxy</id>
<active>true</active>
<protocol>http</protocol>
<host>proxy.somewhere.com</host>
<port>8080</port>
<username>proxyuser</username>
<password>somepassword</password>
<nonProxyHosts>*.google.com|ibiblio.org</nonProxyHosts>
</proxy>
</proxies>
...
</settings>
@See Maven Proxy Settings
Upvotes: 0