This week's giveaway is in the Testing forum.
We're giving away four copies of TDD for a Shopping Website LiveProject and have Steven Solomon on-line!
See this thread for details.
Win a copy of TDD for a Shopping Website LiveProject this week in the Testing forum!
  • 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
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

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: 75642
354
  • 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.....
 
Live ordinary life in an extraordinary way. Details embedded in this tiny ad:
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
https://coderanch.com/t/751654/free-earth-friendly-heat-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic