MasterCL

- Overview -


 
..:: News ::..

February 16, 2004: restructuration of the source code. This is mainly to better understand what really happens. Additionaly, there is not a specific method that subclasses can use to locate some classes.

November 22, 2003: I corrected the descriptions on the website as they were not accurate. I also made a small change to avoid code duplication.

November 20, 2003: This is just a small update, which should add a bit of optimization.

November 19, 2003: I realised this small library a few days ago. This is now the site where to find the MasterCL.

..:: Concept ::..

It is a big hack of the Java class loading mechanism.

It is a solution to a problem that I see sometimes about the delegation model of the ClassLoaders. The rule is that if a parent class loader knows how to load a class, then it will load it. So that does not load the classes you want if they also exist for a higher class loader.

Well this is theory, since I succeeded at runtime to change this rule! Using MasterCL, you invoke a single static method the earliest in your program, and your classes can be loaded.

..:: Features ::..

MasterCL was just a kind of challenge.
Note that, due to the mechanisms in use, the library needs the application to allow some operations like the use of the reflection API.

The MasterCL library allows one to create and use a class that overrides the JRE classes (even if it starts by "java.*" which normally raises an exception). Note that the MasterCL class allows this feature, but using it is against the licence agreement. So don't do it.
It does not perform the same operation as the "-Xbootclasspath" VM parameter. Indeed, it replaces the class for the application but not for the JRE. One can for example recreate an API using the "java.awt." and "javax.swing", but cannot use both JRE classes and custom classes as the JRE does not expect it.

What is interesting, is that the MasterCL still allows to get the original class that should have been loaded. So using the reflection API, it is possible to invoke methods on the legitimate class.
For example, one could create the "java.lang.Integer" class, which shows the same API as the real Integer class, and that redirects the method calls to the original Integer. This is of course an example as, once again, it is against the licence agreement to do so.

It has some restrictions though: it cannot load classes with the same names as some already loaded before MasterCL was invoked.

 
Web site designed by Christopher Deckers
Any questions, suggestions, job offers at