java.lang.ClassNotFoundException for a specified class
02:01 30 Oct 2013

In my main I have the following statement

Class booki = Class.forName("Book");

which throws a java.lang.ClassNotFoundException exception

when I use the full path like Class booki = Class.forName("javatests.Book"); it is ok.

The main class and the Book class are in the same package, I also tried using import static javatests.Book.*; but still it throws the exception if I don't set the full path javatests.Book. Can someone explain to me why?

java classnotfoundexception