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.2 2008/09/10 09:23:34 mungady Exp $ 027 * ------------ 028 * (C) Copyright 2002-2006, by Object Refinery Limited. 029 */ 030 031package org.jfree.base; 032 033import java.util.Enumeration; 034 035import org.jfree.util.ObjectUtilities; 036 037/** 038 * Creation-Date: 02.11.2007, 18:42:27 039 * 040 * @author Thomas Morgner 041 */ 042public class ClassPathDebugger 043{ 044 /** 045 * Entry point. 046 * 047 * @param args command line arguments. 048 */ 049 public static void main(String[] args) 050 { 051 System.out.println ("Listing the various classloaders:"); 052 System.out.println ("Defined classloader source: " + ObjectUtilities.getClassLoaderSource()); 053 System.out.println ("User classloader: " + ObjectUtilities.getClassLoader()); 054 System.out.println ("Classloader for ObjectUtilities.class: " + ObjectUtilities.getClassLoader(ObjectUtilities.class)); 055 System.out.println ("Classloader for String.class: " + ObjectUtilities.getClassLoader(String.class)); 056 System.out.println ("Thread-Context Classloader: " + Thread.currentThread().getContextClassLoader()); 057 System.out.println ("Defined System classloader: " + ClassLoader.getSystemClassLoader()); 058 System.out.println(); 059 try 060 { 061 System.out.println ("Listing sources for '/jcommon.properties':"); 062 Enumeration resources = ObjectUtilities.getClassLoader 063 (ObjectUtilities.class).getResources("jcommon.properties"); 064 while (resources.hasMoreElements()) 065 { 066 System.out.println (" " + resources.nextElement()); 067 } 068 System.out.println(); 069 System.out.println ("Listing sources for 'org/jfree/JCommonInfo.class':"); 070 resources = ObjectUtilities.getClassLoader 071 (ObjectUtilities.class).getResources("org/jfree/JCommonInfo.class"); 072 while (resources.hasMoreElements()) 073 { 074 System.out.println (" " + resources.nextElement()); 075 } 076 } 077 catch (Exception e) 078 { 079 e.printStackTrace(); 080 } 081 082 } 083}