[1733] in java-interest
IllegalAccessException solved
daemon@ATHENA.MIT.EDU (Jay Fenton)
Fri Sep 15 11:42:34 1995
Date: Fri, 15 Sep 1995 14:30:13 -0700
To: java-interest@java.sun.com
From: jay@communities.com (Jay Fenton)
Yesterday I posted this:
>This code throws an exception if I run it from outside of the package in
>which the named class is defined:
>
>Class savedClass = Class.forName(className);
>Object madeguy = savedClass.newInstance();
>
>Why?
I figured it out.
What caused this was that I did not declare the constructor for
myClass to be public. This apparently limits the scope of the
constructor to other classes in this package. Actually not a bad
idea in that it allows one to restrict the ability to manufacture
new instances of a class to those to whom you authorize.
-
Note to Sun employees: this is an EXTERNAL mailing list!
Info: send 'help' to java-interest-request@java.sun.com