Thread.setContextClassLoader used to set contextClassLoader, if it is not installed manually, it will be installed in systemClassLoader, which is equal to Launcher.AppClassLoader , this can be checked by checking the source code of Launcher. 
What is the point of using contextClassLoader?
contextClassLoader provides a back up around the class loading delegation scheme.
The question then becomes, why do we need this back door?
Take JNDI, for example: its guts are implemented by the bootstrap classes in rt.jar (starting with J2SE 1.3), but these core JNDI classes can be loaded by third-party JNDI providers that are potentially deployed in the -classpath application. This script requires the parent class loader (the root cause in this case) to load the class visible to one of its child class loaders (for example, the system one). Delegation with normal J2SE does not work, and a workaround is to make the main JNDI classes using stream context loaders , thereby effectively "tunneling" through the class loader hierarchy in the opposite direction to the correct delegation.
For more information, please check which bootloader class you should use.
source share