Java Thread setContextClassLoader() methodThe setContextClassLoader() method of thread class sets the context ClassLoader for the thread. The context ClassLoader can be set when a thread is created. It allows the creator of the thread to provide the appropriate class loader through getContextClassLoader to code running in the thread when loading classes and resources. SyntaxParametercl: It is the context ClassLoader for Thread ReturnIt does not return any value. ExceptionSecurityException: If the current thread cannot set the context ClassLoader. ExampleTest it NowOutput: Thread is running Context ClassLoader = sun.misc.Launcher$AppClassLoader@4e0e2f2a
Next TopicMultithreading Java
|