This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
when i compile the program it works fine but when i run the program the following errors are displayed
Exception in thread"main" java.lang.noclassdeffounderror:example
caused by: java.lang.classNotFoundException:example
at java.net.URLClassloader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(NAtive method)
at java.net.URLClassloader.loadclass(unknown source)
at sun.misc.Launcher$appClassLoader.loadclass(Unkown csource)
Could not find main class:example .Program will exit.
this is the exact same error irrespective of which program i try to run
Did you compile your program before you're trying to run it?
Is your class really named "example"? (Note, Java is case-sensitive, don't type "example" if it's really named "Example")
Do you have a file "example.class" in the current directory?
What command are you typing exactly to run your program?
Did you set your classpath? If yes, then unset it (you do generally not need to set classpath).
the name is right .when i compile it the compiler does not show any error .the class path was not set i set it later but it still gives me the error.this error is persistent irrespective of the program i try to run . Have tried everything i can think of .
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." — Brian W. Kernighan.