I'm trying to create an object dynamically using java reflection and when I try to execute Class.forName() it returns me the ClassNotFoundException, this is my code:
Class cls = Class.forName("foo.bar.baz.turn."+ nextStateName);
where nextStateName is the class name which I want to create. The strange thing is that if I try to do
Class cls = Class.forName("foo.bar.baz.turn.nameclass");
it works. What am I doing wrong?
Aucun commentaire:
Enregistrer un commentaire