Home » Java Thread getContextClassLoader() Method with Examples

Java Thread getContextClassLoader() Method with Examples

by Online Tutorials Library

Java Thread getContextClassLoader() method

The getContextClassLoader() method of thread class returns the context ClassLoader for the thread.

Syntax

Return

It returns the context ClassLoader for the Thread.

Exception

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

Example

Test it Now

Output:

Context ClassLoader = [email protected]  Parent = [email protected]  Class = class jdk.internal.loader.ClassLoaders$AppClassLoader  Thread is running  

You may also like