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

When will we use them?

0 Answers  


What is I/O Filter?

2 Answers   TCS, WAX,


Why is singleton not thread safe?

0 Answers  


What is an example of declaration?

0 Answers  


Where can I find jdk in my computer?

0 Answers  


program to find 25 square = 625 here the 625 of last two digits is equal to 25, i don't know excatly what this type of number is called

1 Answers   Huawei,


Does a function need a return?

0 Answers  


What is ternary operator in java?

0 Answers  


What is a hashmap used for?

0 Answers  


What are the different approaches to implement a function to generate a random number?

0 Answers   Axtria, ITC Indian Tobacco Company,


What is method Overloading in the perspective of OOPS?

6 Answers  


What is java util list?

0 Answers  


Categories