why should we get the following error ?
Exception in main method NoClassDefFoundError:classname

could anyone give the detail clarification on how java
compiler can look for .class file?

Answer Posted / hardik

In most gnral mistech one make is file name and class name
error than this error accurs mostly , or no classname found
when the environment variable or class path is not given

Java compilor search for the path given to the class name
(ig in cmd javac searching in same folder if we have given
path = ./) .class files than java command searchs for the
same path but if it is not given to the same this error
comes. and java compilor never looks for the class file it
looks for the the .java file and it creates .class file
which than looked by java run time environment.

Is This Answer Correct ?    3 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are keyboard events?

839


What is unicode datatype?

714


What is java autoboxing?

726


What is the function of java?

733


Is it possible to specify multiple jndi names when deploying an ejb?

766


Can constructor return value?

734


What is adapter in java?

710


What are basic keywords?

786


Is hashset sorted in java?

863


In a container there are 5 components. I want to display all the component names, how will you do that?

1853


What are the java ide's? Explain

739


How do constructors use this() and super()?

794


What is meant by interface?

781


What do you understand by classes in java?

763


What is a double vs float?

741