Java: Class.forName() to retrieve inner class
Sounds trivial, but was not obvious because Eclipse IDE mislead me: How do I get a reference to a inner class by calling Class.forName() ?
package a.b.c;
public class Outer {
...
public static class Inner {
...
}
...
}
I first tried to call Class.forName() passing as parameter the fully qualified name generated by Eclipse:
Class innerClass = Class.forName("a.b.c.Outer.Inner");
But that was wrong! After wondering for some time, I found the (obvious solution):
Class innerClass = Class.forName("a.b.c.Outer$Inner");
Looks like as Eclipse “fully qualified” name is not exactly the same fully qualified name that the Java compiler uses to identify inner classes.

