Is it possible in Java to hide classes from the platform with custom classes? For instance to create a custom java.lang.String or custom java.lang.StringBuffer? I am asking because I recently discovered there is an option in C# /nostdlib that allows you to redefine the entire System namespace and I was wondering if Java had something similar.
Note, C#’s /nostdlib is a compiler option, not something that gets taken into account at runtime.
You can use your own classes for the library classes. When starting you can define a
-bootclasspathto define your own class library.This will not an easy task because some classes are tighgtly bound to the VM running, e.g. the class
String. You have to look at the JLS for such cases.