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

NoClassDefFoundError

 
Ramm Kummar
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Getting this error while running java. Please suggest. I have defined required things in the classpath

 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You always need to give the fully qualified classname: "java com.wickedlysmart.CmdArgs". This should work assuming that the "classes" directory is in the classpath.
 
Eric Larsen
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
From what I can see, you are currently in the same directory as your .class file. Instead of running the class from here, you should run it from the /classes directory, like this:

C:\MyProject\classes\>java com.wickedlysmart.CmdArgs

That is, assuming that the class includes a package statement at the beginning of the file:

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic