Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes Ant, Maven and Other Build Tools and the fly likes Maven - ClassNotFoundException Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "Maven - ClassNotFoundException" Watch "Maven - ClassNotFoundException" New topic
Author

Maven - ClassNotFoundException

Graeme Byers
Ranch Hand

Joined: Apr 16, 2004
Posts: 127
This may be a simple Java ClassNotFoundException rather than Maven but I can't spot it.

Thank you for any help.

I'm following 'Maven - The Definitive Guide' page 54.

Step 1 :



Step 2 :



Step 3 :


Step 4 :





Graeme Byers
Ranch Hand

Joined: Apr 16, 2004
Posts: 127
Forgot to mention : %CLASSPATH% contains C:\ch-custom\simple-weather\target\classes
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5838
    
    7

You are using the Exec plugin. You need to post the entire definition of that plugin from your pom.xml file (Maven - The Definitive Guide, page 54, doesn't show the Exec plugin being used). Apparently, you didn't set the classpath, or you used the wrong target (you should be using exec:java, not exec:exec).

Also, "The Definitive Guide" has be superceeded by "The Complete Reference": http://www.sonatype.com/books/mvnref-book/reference/


JBoss In Action
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5838
    
    7

Graeme Byers wrote:Forgot to mention : %CLASSPATH% contains C:\ch-custom\simple-weather\target\classes

Never set CLASSPATH, that's a sure way to get yourself into trouble because you will at some point accidentally pick up the wrong class file. Besides, you should not have to do that when using Maven.
 
 
subject: Maven - ClassNotFoundException