Javatpoint Logo
Javatpoint Logo

Java Thread setContextClassLoader() method

The 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.

Syntax

Parameter

cl: It is the context ClassLoader for Thread

Return

It does not return any value.

Exception

SecurityException: If the current thread cannot set the context ClassLoader.

Example

Test it Now

Output:

Thread is running
Context ClassLoader = [email protected]






Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA