The problem is that my constructor needs the parameter "Board" which is the handle to the other class, but I cannot pass the parameter in claz.newInstance()
You see that I want to load classes dynamically where the class name is known at run time.
Any ideas what to do about this?
posted 7 years ago
well, I figured out that I can use
Element elm = (Element) claz.getDeclaredConstructor(Board.class).newInstance(this);
Element elm = (Element) claz.newInstance();
which works fine, but still if anyone has a better proposal, please let share it. Thanks
He does not suffer fools gladly. But this tiny ad does: