Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

No class def found error on other computers

 
Enrique Gonzalez Moore
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • 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.

 
Jesper de Jong
Java Cowboy
Saloon Keeper
Posts: 15485
43
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • 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?
 
marc weber
Sheriff
Posts: 11343
Java Mac Safari
  • Mark post as helpful
  • send pies
  • 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?
 
Campbell Ritchie
Sheriff
Pie
Posts: 50240
79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Another possibility: did you re-compile your code on the new computer?
 
Shanky Sohar
Ranch Hand
Posts: 1051
Eclipse IDE Firefox Browser
  • Mark post as helpful
  • send pies
  • 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
  • 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.....
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic