• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

NoClassDefFoundError

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Trying to use Dos to run programs. I can compile fine but when I try to run programs I keep getting a Exception found in thread "Main" java.lang.NoClassDefFoundError: <name of program>
 
Ranch Hand
Posts: 158
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I would imagine this is a problem with your CLASSPATH settings.
Please check that the directory containing your complied file is included in your classpath.

for example if you have
a file called Test.java
compiled to genetrate Test.class
in directory called c:\javaprojects
Then your classpath must include c:\javaprojects
This is just an example- your own files & directories can have any names you choose.
Also remember that the java names are case-sensitive.
Check that your source file has a main method.
regards,
Jyotsna
 
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
check ur classpath it must include ur directory name where from u r running ur application (java program)
best of luck
Rajesh
 
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can use the following to specify 'THIS' directory:
java -classpath . File
Replace File with the name of your program.
P.S. You said it compiled OK, but if you ever need to, you can also compile specifying 'THIS' directory:
javac -classpath . File.java

Susan
 
Jeff Bergan
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks, using -classpath worked like a charm
jeff
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic