Java Spike: ClassLoader

Motivation

The ability to write custom ClassLoaders is one of the most powerful features available in a Java environment. If you can get your bytecode into an array of bytes then you can get that bytecode loaded into the JVM as though it were deployed as an ordinary class.

Amongst other things you can use this to:

Features

If you run ClassLoaderSpike.java, an instance of the custom classloader in DemonstrationLoader.java will be created. An attempt will then be made to load a class called "TestClass" from this DemonstrationLoader.

The DemonstrationLoader will open a file called "TestClass" from the subdirectory "classees". Note the absence of the .class extension that the default classloader uses) from the subdirectory classes.