1

I have this problem when I run my program in java.However I have main method ,I have saved My file with the name of MyClass and run it in a right path.thanks in advance..

Exception in thread "main" java.lang.NoClassDefFoundError:MyClass
caused by:java.lang.classNotFoundException:MyClass
at java.net.URLClassLoader$1.run(Unknown sourse)
at java.security.AccessCountroller.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown sourse)
at java.lang.ClassLoader.loadClass(Unknown sourse)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown sourse)
at java.lang.ClassLoader.loadClass(Unknown sourse)
could not find the main class:Myclass.program will exit
4
  • did you add the file to project? Commented Feb 20, 2012 at 1:01
  • 2
    If you don't post the code for the main method we can't really help you. Also, please tell us how you're compiling the code. Is it part of an eclipse project, ant, etc. Commented Feb 20, 2012 at 1:02
  • A bit more information would be useful. For now it seems that your trying to run a .java file in Java. Commented Feb 20, 2012 at 1:04
  • Just wanted to say, main thread does not imply main method. Commented Feb 20, 2012 at 2:57

1 Answer 1

2

I wonder about this:

main class:Myclass.program

Myclass is not the same as MyClass. Java is case sensitive.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.