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?

Answers were Sorted based on User's Feedback



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

Answer / 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

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

Answer / narsimharaju

When we compile our java .class file then it is not available then we will get a runtime exception saying
NoClassDefFoundError:classname.

Is This Answer Correct ?    1 Yes 1 No

Post New Answer

More Core Java Interview Questions

What is multithreading and its advantages?

0 Answers  


What happens when you assigned a 'double' value to a 'String'?

8 Answers  


what is use of threads how many ways to create thread

3 Answers   iTrust, Verizon,


class a extends b { } class b extends a { } why java doesn't support cyclic pls explain me with example

3 Answers   Wipro,


what are different ways in which a thread can enter the waiting state? : Java thread

0 Answers  






What is a class object?

0 Answers  


I have a String s = java; What is the output when I say s.replaceAll('j', 'k'); Also what is the value of s after replacing?

8 Answers   KPIT,


What is the method overriding?

0 Answers  


What is anti pattern in cyber security?

0 Answers  


Is char * a string?

0 Answers  


What is the multi-catch block in java?

0 Answers  


What is the blank final variable?

3 Answers  


Categories