9.1.3. Writing Your Own Class Loader
You can write your own class loader for specialized purposes. That lets you carry out custom checks before you pass the bytecodes to the virtual machine. For example, you can write a class loader that can refuse to load a class that has not been marked as “paid for.”
To write your own class loader, simply extend the
ClassLoader class and override the method
loadClass method of the
ClassLoader superclass takes care of the delegation to the parent and calls
findClass only if the class hasn’t already been loaded and if the parent class loader was unable to load the class.
Your implementation of this method must do the following:
1. Load the bytecodes for the class from the local ...