aspose file tools*
The moose likes Beginning Java and the fly likes No class def found error on other computers Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "No class def found error on other computers" Watch "No class def found error on other computers" New topic
Author

No class def found error on other computers

Enrique Gonzalez Moore
Greenhorn

Joined: Jun 12, 2010
Posts: 7
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

Joined: Aug 16, 2005
Posts: 14352
    
  22

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?

Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 8 API documentation
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

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

Joined: Oct 13, 2005
Posts: 39888
    
  28
Another possibility: did you re-compile your code on the new computer?
Shanky Sohar
Ranch Hand

Joined: Mar 17, 2010
Posts: 1051


recompile your code and make sure that your class will be there in a build path......

SCJP6.0,My blog Ranchers from Delhi
Shanky Sohar
Ranch Hand

Joined: Mar 17, 2010
Posts: 1051

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.....
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: No class def found error on other computers