Maven 2 -- classworlds.Launcher not found

The other day I suddenly started getting this error when running maven 2 on my gentoo box.

Exception in thread "main" java.lang.NoClassDefFoundError: org/codehaus/classworlds/Launcher

The great oracle of google wasn't much help. I finally figured out that I had installed, or emerged in gentoo parlance, maven and this was causing a conflict with the maven I had installed in my home directory. I had edited my .bashrc file with the necessary environment variables but now bash was finding mvn on the /usr/bin path rather than in my home directory.

I uninstalled, or unmerge, maven-bin and everthing worked fine again. In general I find it best to install all your java related build tools by hand in your home directory on Linux systems. This avoids all those permission issue which are designed to protect production system but are just an annoyance when developing..

When you are developing you don't want to have to su to root just to deploy your war. I usually have eclipse, maven and jetty installed in my home directory. It enables me to install eclipse plugins, upgrade maven etc without having to wait for the distro to catch up.


Share this page!
Add to Technorati Favorites Slashdot Slashdot It! Afrigator

Maven + netbeans

The issiue showed up when i configured netbeans to work with maven. Netbeans moved the classworlds jar from $M2_HOME/bin to $M2_HOME/bood dir in the maven installation directory. Adding the new path to java classpath solved the problem.... that netbeans wrecks havoc on my pc :-/

regards
chriss

that's exactly what i needed!

thanks for the tip! i got into the exact same problem - edit my .bashrc and maven stop working in netbeans 6.1.

Cheers!
Alex
www.LoveParisHotel.com - Guide To Paris Hotels

Same problem

Hey, I am having the same problem I type in "mvn" and I get:

Exception in thread "main" java.lang.NoClassDefFoundError: org/codehaus/classworlds/Launcher

What did you do to your file? I don't have a bash_src.

Thanks!

Ryan

fix

I had this problem after installing maven2 using JDK 1.6, all on a mac (leopard). To fix, all I did was run "sudo mvn --version". And it worked, I guess it was a permissions thing for me.

thx

Thanks!

Have you figured out what

Have you figured out what the problem was and how to run mvn without root privileges? I have the same issue, but I'd like to be able not to use root.

Something you can try

If you are setting the M2_HOME variable in .profile or something, don't.

Remove your M2_HOME variable, log out, log back in, and try again.

I was getting this same error, did that, and then I was able to use maven2 without being root. (Using Mint, an Ubuntu variation).

Many thanks

Many thanks, works for me on xubuntu, 1.6 iced tea also ;)

You really helped me with

You really helped me with this comment. I wouldnt find out myself that I had two mavens by mistake!!!
Thanks man!

Thank you. this hints is awesome

I removed the Maven_home env var from my .profile and now the error went away.