In general, the loading of a class by any class loader comprises the following steps:
1. Read the bytes of the class.
2. Define the class by interpreting the bytes of the class as per the rules of the JVM. This step identifies whether the class definition is correct or not.
3. Resolve the class - link the specified class.
Any custom class loader should extend the java.lang.ClassLoader.
The FileClassLoader loads the class as follows:
1. If the class is a standard java class, then let the parent class loader load it.
2. Otherwise, get the class from cache, if it exists and return.
3. If the class is not in the cache, then locate it physically and get its bytes.
4. If the class is not found, then let the parent class loader attempt to find it.
5. If the class is found, then define the class.
6. Cache the loaded Class object and return the same.
Note: According to the rules of the JVM, a class cannot be loaded by the same instance of the ClassLoader more than once. Therefore, if a class is modified and needs to be loaded again by the FileClassLoader, then a new instance of FileClassLoader needs to be created. The library supports dynamic class loading. If the same instance of FileClassLoader is used to load a class (which is modified) again, then a message is logged and the old class definition is returned.