001    /**
002     * ========================================
003     * JCommon : a free Java report library
004     * ========================================
005     *
006     * Project Info:  http://www.jfree.org/jcommon/
007     *
008     * (C) Copyright 2000-2006, by Object Refinery Limited and Contributors.
009     *
010     * This library is free software; you can redistribute it and/or modify it under the terms
011     * of the GNU Lesser General Public License as published by the Free Software Foundation;
012     * either version 2.1 of the License, or (at your option) any later version.
013     *
014     * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
015     * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
016     * See the GNU Lesser General Public License for more details.
017     *
018     * You should have received a copy of the GNU Lesser General Public License along with this
019     * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
020     * Boston, MA 02111-1307, USA.
021     *
022     * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
023     * in the United States and other countries.]
024     *
025     * ------------
026     * $Id: ClassPathDebugger.java,v 1.1 2007/11/02 17:50:34 taqua Exp $
027     * ------------
028     * (C) Copyright 2002-2006, by Object Refinery Limited.
029     */
030    
031    package org.jfree.base;
032    
033    import java.util.Enumeration;
034    
035    import org.jfree.util.ObjectUtilities;
036    
037    /**
038     * Creation-Date: 02.11.2007, 18:42:27
039     *
040     * @author Thomas Morgner
041     */
042    public class ClassPathDebugger
043    {
044      public static void main(String[] args)
045      {
046        System.out.println ("Listing the various classloaders:"); 
047        System.out.println ("Defined classloader source: " + ObjectUtilities.getClassLoaderSource());
048        System.out.println ("User classloader: " + ObjectUtilities.getClassLoader());
049        System.out.println ("Classloader for ObjectUtilities.class: " + ObjectUtilities.getClassLoader(ObjectUtilities.class));
050        System.out.println ("Classloader for String.class: " + ObjectUtilities.getClassLoader(String.class));
051        System.out.println ("Thread-Context Classloader: " + Thread.currentThread().getContextClassLoader());
052        System.out.println ("Defined System classloader: " + ClassLoader.getSystemClassLoader());
053        System.out.println();
054        try
055        {
056          System.out.println ("Listing sources for '/jcommon.properties':");
057          Enumeration resources = ObjectUtilities.getClassLoader
058              (ObjectUtilities.class).getResources("jcommon.properties");
059          while (resources.hasMoreElements())
060          {
061            System.out.println (" " + resources.nextElement());
062          }
063          System.out.println();
064          System.out.println ("Listing sources for 'org/jfree/JCommonInfo.class':");
065          resources = ObjectUtilities.getClassLoader
066              (ObjectUtilities.class).getResources("org/jfree/JCommonInfo.class");
067          while (resources.hasMoreElements())
068          {
069            System.out.println (" " + resources.nextElement());
070          }
071        }
072        catch (Exception e)
073        {
074          e.printStackTrace();
075        }
076    
077      }
078    }