Java Programming/Reflection/Dynamic Class Loading

Dynamic Class Loading allows the loading of java code that is not known about before a program starts. Many classes rely on other classes and resources such as icons which make loading a single class unfeasible. For this reason the   is used to manage all the inner dependencies of a collection of classes. The Java model loads classes as needed and doesn't need to know the name of all classes in a collection before any one of its classes can be loaded and run.

Simple Dynamic Class Loading
An easy way to dynamically load a  is via the   class. This class can be used to load a  or a collection of classes that are accessible via a URL. This is very similar to the  parameter in the   executable. To create a, use the factory method (as using the constructor requires a security privilege):

Unlike other dynamic class loading techniques, this can be used even without security permission provided the classes come from the same Web domain as the caller. Once a  instance is obtained, a class can be loaded via the   method. For example, to load the class, one would:

Executing code from a  instance is explained in the Dynamic Invocation chapter.