Java examples for Reflection:Class Loader
Returns the context class loader.
//package com.java2s; public class Main { public static void main(String[] argv) throws Exception { System.out.println(getLoader()); }/* w ww . jav a2 s . co m*/ /** * Returns the context class loader. * * @return the context class loader */ public static ClassLoader getLoader() { ClassLoader loader = Thread.currentThread().getContextClassLoader(); if (loader == null) { loader = ClassLoader.class.getClassLoader(); } return loader; } }