• Post Reply Bookmark Topic Watch Topic
  • New Topic

NoClassDefFoundError  RSS feed

 
Gayatri Ganesh
Ranch Hand
Posts: 143
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am trying to run a file.
I set the classpath with xerces.jar, xalan.jar and xml-apis.jar.
when i compile my java file, it gives me no errors and I can see a .class file created.
but when I say :
java a.b.c.File

I get following error :

Exception in thread "main" java.lang.NoClassDefFoundError:

I can't understand why it can't find the .class file when I can see it.
Also on the DOS prompt if i say "dir", i can see the .class file.

Does anyone know how to get rid of this problem ?

Thanks,
Gayatri
 
Steve Morrow
Ranch Hand
Posts: 657
Clojure Spring VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try this:



Note the spaces and period. Also, ensure your class was compiled with the proper package statement.
 
Dale Seng
Ranch Hand
Posts: 275
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I agree with the previous post as long as the "package" situation is under control. Launching from the command line is a pain if you are not using the default package; I usually create a batch file, tweak it (many times), then finally I have something to refer back to that worked.

Generally, if you have a 'base' directory, and a package called com.dale.stuff, you would need to launch from the base directory, but launch "com/dale/stuff/Myprog.java". You can find out much more at http://www.mindprod.com/jgloss/package.html, but if your situation allows it, I would download Eclipse (http://www.eclipse.org/downloads/download.php?file=/eclipse/downloads/drops/R-3.1-200506271435/eclipse-SDK-3.1-win32.zip) and let it take care of launching (for the most part).
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!