• 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

No class def found error on other computers

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
My code runs fine on my computer but when I run it on other computers I get a NoClassDefFound error. The is below. Could someone tell me how to correct this? Thank you.

 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What is the exact error message; which class is it that Java cannot find?

What version of Java are you using and what version of Java is running on those other computers?

How are you trying to run the class on the other computers; as an applet via the browser, as a stand-alone program (your applet has a main method) or some other way? If you're running it from the command line, then what's the exact command you're entering?

NoClassDefFoundErrors are almost always caused by a wrong classpath. Did you set the classpath? Does the classpath include the directory that contains the class file for your program?

Is the file FtoC.class (the compiled class file, not the source file) available on the other computers?
 
Sheriff
Posts: 11343
Mac Safari Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Enrique Gonzalez Moore wrote:My code runs fine on my computer but when I run it on other computers I get a NoClassDefFound error...


Note that this code generates a couple of nested classes, FtoC$1.class and FtoC$2.class. Are these the ones not found?
 
Marshal
Posts: 79177
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Another possibility: did you re-compile your code on the new computer?
 
Ranch Hand
Posts: 1051
Eclipse IDE Firefox Browser
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

recompile your code and make sure that your class will be there in a build path......
 
Shanky Sohar
Ranch Hand
Posts: 1051
Eclipse IDE Firefox Browser
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
also make sure that JVM should be of same version which you are using on your computer....this may be also one of the problem.......
but the most probably the problem is your class is not on build path.......
adding a class to a build path will resolve your problem.....
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic