I expect the system classloader to take over class loading for my application. So, if I run my program as,
java -Djava.system.class.loader=MyClassLoader Main
I expect Main to be loaded by MyClassLoader so that I can control class loading within my application. But that does not happen. Main is still loaded by the default system class loader (sun.misc.Launcher$AppClassLoader), as are other classes referenced from Main. However, calls to getSystemClassLoader() return an instance of MyClassLoader.
How is this useful? Wouldn't it make sense for Main to be loaded by my custom system class loader? How do I take control of class loading for my application? And who uses the getSystemClassLoader() value?