Tag Archives: Maven installation

Problems encountered after Maven installation or upgrade: could not find or load main class org.codehaus.plexus .class…..

After the M2_HOME environment variable is changed, mVN-V is executed on the terminal and the following error occurs:
 
Exception in thread “main” java.lang.NoClassDefFoundError: org/codehaus/plexus/classworlds/launcher/Launcher
Caused by: java.lang.ClassNotFoundException: org.codehaus.plexus.classworlds.launcher.Launcher
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
Could not find the main class: org. Codehaus. Breadth. Classworlds. The launcher. The launcher. The Program will exit.
 
 
If you are a Linux system, you may be in the/etc/profile, ~ /. Following/~/bashrc file configured in the environment variable M2_HOME, when M2_HOME value change, even if you execute the source/etc/profile operation, also can appear as wrong, then you will need to open a terminal or log back in to, if you are a Windows system, to open a CMD window, generally is ok, So the root cause of the appeal error is that mVN-V was executed on the same terminal when switching between two versions of Maven without opening a new terminal or logging in again.