Java tutorial
class ThreadDemo extends Thread { public void run() { // returns the context ClassLoader for this Thread ClassLoader c = getContextClassLoader(); // sets the context ClassLoader for this Thread setContextClassLoader(c); System.out.println("Class = " + c.getClass()); System.out.println("Parent = " + c.getParent()); } } public class Main { public static void main(String args[]) { ThreadDemo t = new ThreadDemo(); // this will call run() function t.start(); } }