Accessing non-visible classes with reflection
I am trying to get an instance of a non-visible class, AKA package private class, using reflection. I was wondering if there was a way to switch the modifiers to make it public and then access it using Class.forName . When I try that now it stops me saying I can't do it. Unfortunately there is no setAccesible method of the Class class. Pshemo nested class - class defined within other class (includes static and non-static classes) inner class - non-static nested class (instance of inner class need instance of outer class to exist) non-nested (top level) classes Based on your question we know