Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Maven - ClassNotFoundException

 
Graeme Byers
Ranch Hand
Posts: 127
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 127
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Forgot to mention : %CLASSPATH% contains C:\ch-custom\simple-weather\target\classes
 
Peter Johnson
author
Bartender
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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/
 
Peter Johnson
author
Bartender
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic