Frames | No Frames |
1: /** 2: * ======================================== 3: * JCommon : a free Java report library 4: * ======================================== 5: * 6: * Project Info: http://www.jfree.org/jcommon/ 7: * 8: * (C) Copyright 2000-2006, by Object Refinery Limited and Contributors. 9: * 10: * This library is free software; you can redistribute it and/or modify it under the terms 11: * of the GNU Lesser General Public License as published by the Free Software Foundation; 12: * either version 2.1 of the License, or (at your option) any later version. 13: * 14: * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 15: * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 16: * See the GNU Lesser General Public License for more details. 17: * 18: * You should have received a copy of the GNU Lesser General Public License along with this 19: * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, 20: * Boston, MA 02111-1307, USA. 21: * 22: * [Java is a trademark or registered trademark of Sun Microsystems, Inc. 23: * in the United States and other countries.] 24: * 25: * ------------ 26: * $Id: ClassPathDebugger.java,v 1.2 2008/09/10 09:23:34 mungady Exp $ 27: * ------------ 28: * (C) Copyright 2002-2006, by Object Refinery Limited. 29: */ 30: 31: package org.jfree.base; 32: 33: import java.util.Enumeration; 34: 35: import org.jfree.util.ObjectUtilities; 36: 37: /** 38: * Creation-Date: 02.11.2007, 18:42:27 39: * 40: * @author Thomas Morgner 41: */ 42: public class ClassPathDebugger 43: { 44: /** 45: * Entry point. 46: * 47: * @param args command line arguments. 48: */ 49: public static void main(String[] args) 50: { 51: System.out.println ("Listing the various classloaders:"); 52: System.out.println ("Defined classloader source: " + ObjectUtilities.getClassLoaderSource()); 53: System.out.println ("User classloader: " + ObjectUtilities.getClassLoader()); 54: System.out.println ("Classloader for ObjectUtilities.class: " + ObjectUtilities.getClassLoader(ObjectUtilities.class)); 55: System.out.println ("Classloader for String.class: " + ObjectUtilities.getClassLoader(String.class)); 56: System.out.println ("Thread-Context Classloader: " + Thread.currentThread().getContextClassLoader()); 57: System.out.println ("Defined System classloader: " + ClassLoader.getSystemClassLoader()); 58: System.out.println(); 59: try 60: { 61: System.out.println ("Listing sources for '/jcommon.properties':"); 62: Enumeration resources = ObjectUtilities.getClassLoader 63: (ObjectUtilities.class).getResources("jcommon.properties"); 64: while (resources.hasMoreElements()) 65: { 66: System.out.println (" " + resources.nextElement()); 67: } 68: System.out.println(); 69: System.out.println ("Listing sources for 'org/jfree/JCommonInfo.class':"); 70: resources = ObjectUtilities.getClassLoader 71: (ObjectUtilities.class).getResources("org/jfree/JCommonInfo.class"); 72: while (resources.hasMoreElements()) 73: { 74: System.out.println (" " + resources.nextElement()); 75: } 76: } 77: catch (Exception e) 78: { 79: e.printStackTrace(); 80: } 81: 82: } 83: }