Java FAQ: Top Questions
49. What is a custom ClassLoader in Java?
A
custom ClassLoader
extends
ClassLoader
to load classes from non-standard sources (e.g., network, encrypted files) or modify bytecode dynamically.
-
Class Loading:
Defines classes from byte arrays using
defineClass
. - Delegation Model: Checks parent loader first, then custom logic.
- Security: Must handle verification and permissions.
- Use Case: Application servers, plugins, or dynamic code loading.