File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Ant, Maven and Other Build Tools and the fly likes Strange error running Maven Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "Strange error running Maven" Watch "Strange error running Maven" New topic

Strange error running Maven

Alejandro Barrero
Ranch Hand

Joined: Aug 01, 2005
Posts: 327
I unziped the maven distribution, added bin to the path and created the variable MAVEN_HOME. I am running "mvn -version" but I get the error:
Error occurred during initialization of JVM
java/lang/NoClassDefFoundError: java/lang/object
Googling I found that this error can occur if java.exe has been copied to Window/System23. Unbelivable, it had happen; I deleted the file and other java files, but the problem persisted. I put the java bin at the beginning of the path to no avail; the problem is still there. It is not happening with other applications.

Your help will be greatly appreciated,

Alejandro Barrero

Your help will be greatly appreciated,
Alejandro Barrero
Jeanne Boyarsky
author & internet detective

Joined: May 26, 2003
Posts: 33102

Try restarting DOS and then typing "java -version" and "path". Is it using the version/location that you want it to be?

[OCA 8 book] [Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
Alejandro Barrero
Ranch Hand

Joined: Aug 01, 2005
Posts: 327
Thank you very much for your prompt reply. I have verified that "java -version" works and I have restarted DOS and rebooted my computer. I am using Java 7. Is there anything I can do in the configuration file?
Peter Johnson

Joined: May 14, 2008
Posts: 5852

First, there is nothing wrong with java.exe being located in system32, the JRE installer places it there and it should not be causing a conflict (unless there is something else messed up on your system).

My suggestion is to reinstall the latest JDK (uninstall all JDKJs abnd JREs you have currently installed and download the latest JDK 7 from the Oracle web site). Once you have reinstalled it, make sure JAVA_HOME is set properly and that the JDK bin directory is in your path. The open a command prompt and run "java -version" and make sure you get a good result. Then try "mvn -version" again.

JBoss In Action
I agree. Here's the link:
subject: Strange error running Maven
jQuery in Action, 3rd edition