jeudi 19 mars 2015

NullPointerException while calling Class.newInstance

I am getting a null pointer exception on newInstance line, can't understand why.


There is no constructor in that class.

Also classname_prop is valid, as if it was not valid I would get a classnotfound exception.



static private MYInterface myInterface = null;
static{
try {

myInterface = (MYInterface) Class.forName(classname_prop).newInstance();

}

}


what can cause this error?






Aucun commentaire:

Enregistrer un commentaire