Exception in thread "main" java.lang.NoClassDefFoundError:

I can compile my program correctly with no errors.But whenever I try to run it a message
Exception in thread "main"java.lang.NoClassDefFoundError: calculate
is given.when I run the same program from any other computer it runs.Someone has told me to check my classpath.I have checked it.But I can't fix the problem.Please give me the solutions in detail.

Comments

  • : I can compile my program correctly with no errors.But whenever I try to run it a message
    : Exception in thread "main"java.lang.NoClassDefFoundError: calculate
    : is given.when I run the same program from any other computer it runs.Someone has told me to check my classpath.I have checked it.But I can't fix the problem.Please give me the solutions in detail.
    :


  • Save your file name as the name you have given to your class
    and save the file as classname.java .
    .....>
    Be carefull if you are using a notepad
    Save as
    "classname.java"
    if u save as
    classname.java the file will be saved as classname.java.txt
    <.....
  • I get the same problem, it would run java files fine until i installed visual studio 2005. now it compiles the file but when i try to run the file it says:
    Exception in thread "main"java.lang.NoClassDefFoundError:
    I think it has changed all my java files into J# files. Can anyone help me fix the problem so i can run my java files as before?
  • Set the Classpath.

    Check out

    http://www.freejavaguide.com/corejava.htm to know how to go about to tackle this probelm.
    http://www.freejavaguide.com

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories