By default, the Loader class only loads the .class file once, even if you use it several times in your program. After the load.class file, if it is modified externally, then the class loader will not load the updated version of the class file by default (the .class file is already available in the method area). You can solve this problem by specifying your own custom classloader.
The main advantage of a custom class loader is the management of the class loading mechanism based on your requirement.
java.lang.ClassLoader to define your own custom classloader. Each class loader in JAVA must be a child of the java.lang.ClassLoader class, or directly indirectly. Therefore, this class acts as the base class for all custom classloaders.
Note. . When designing / developing web servers and application servers, typically custom class loaders are used for a custom class loading mechanism.
For instance:
public class CustClassLoader extends ClassLoader{ public Class loadClass(String cname) throws ClassNotFoundException{
source share