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

Break statement can be used as labels in java?

549


Can we write class inside a class in java?

548


Explain implementation and how is it different from conversion?

583


What is %02d?

573


What is the maximum size of hashmap in java?

529






Outline the major features of java.

561


How do you find the absolute value?

557


What java ide should I use?

561


What is the difference between the reader/writer class hierarchy and the inputstream/outputstream class hierarchy in java programming?

600


What is an object in java and how is it created?

581


Is java call by reference?

525


What is static method with example?

612


How to use string tokenizer class.

614


How are this() and super() used with constructors in java programming?

566


What is the use of StringTokenizer class?

605