This week's book giveaway is in the General Computing forum. We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line! See this thread for details.
I am using class.forname to create a new instance of class.The classname comes from a properties.
Lets say i have several classes in two packages.
On initialisation, the above classnames are put in a vector. The vector is then accessed and each class is initialised as shown below
The code above is in the class ParserLoader which is in the same package as parsers 1,2,3.
Parsers 1, 2 and 3 all implement the ParserInterface.
Parsers 4,5 and 6 all extend the GenericParser abstract class.
The GenericParser abstract class implements the ParserInterface.
None of the parsers have a constructor so default constructors will be used.
When i run the above it generates an exception shown below
Any ideas why this is happening and could the structure of the packaging be a cause for this?
Another problem i am having is i cant see any stack trace. There is no stacktrace! I only see that error in eclipse when i debug the application and look at the content of the parsers vector. The vector should contain references to the parser objects. The parsers in com.package.* package are fine but it is not creating instances of any parser in the net.package.* package.
Are you sure that the interfaces and abstract classes aren't included in the list? If you broke that long line into several, you could print out the name of each class before attempting to process it; that's tell you which one was failing.