...
The java.lang.ClassLoader
class and its descendent classes are the means by which new code is dynamically loaded into the JVM. Every class provides a link to the ClassLoader
that loaded it; furthermore every class loader class also has its own class that loaded it, on down to a single 'root' class loader. ClassLoader
itself is abstract, so it cannot be instantiated. All class loaders inherit from SecureClassLoader
, which itself inherits from ClassLoader
. SecureClassLoader
performs security checks on its members, as do its descendents. It defines a getPermissions()
method, which indicates the privileges available to classes loaded by the class loader, This serves to provide protection mechanisms limiting what additional classes may be loaded by untrusted code.
Misc.
This is more classloader stuff that isn't strictly necessary to understand the rules
Class loaders, as well as some other sensitive classes, have the ability to modify or completely avoid security manager access controls. Many class loaders check package access permissions before attempting to load a class (see table below). However, instantiating a URLClassLoader
using either of its constructors bypasses the call to the security manager's checkPackageAccess()
method. Although the package access check is an optional step (no Oracle-manufactured URL class loader performs it), it is a good idea to ensure that the program is actually allowed to access the class being loaded.
...