I\'ve tried both the example in Oracle\'s Java Tutorials. They both compile fine, but at run-time, both come up with this error:
Exception in thread \"main\"
No Class Definition Exception occurs when the intended class is not found in the Class Path. At Compile Time Class : Class was generated from Java Compiler, But Somehow at Run Time the Dependent Class is not found.
Lets go through one Simple Example :
public class ClassA{
public static void main(String args[]){
//Some gibberish Code...
String text = ClassB.getString();
System.out.println("Text is :" + text);
}
}
public class ClassB{
public static String getString(){
return "Testing Some Exception";
}
}
Now Lets assume that the above two Java Source Code are placed in some Folder let say "NoClassDefinationFoundExceptionDemo"
Now open a shell(Assuming Java is already being setup correctly)