FileDocCategorySizeDatePackage
TestLoader.javaAPI DocExample1379Sat Sep 09 21:21:22 BST 2000None

TestLoader

public class TestLoader extends Object

Fields Summary
Constructors Summary
Methods Summary
public static voidmain(java.lang.String[] args)

    
    try {      
      System.out.println("With the URLConnection's class loader"); 
      URL u = new URL("http://metalab.unc.edu/javafaq/");
      URLConnection uc = u.openConnection();
      Object o = Class.forName("com.macfaq.net.www.content.text.tab", 
       true, u.getClass().getClassLoader());
      System.out.println(o); 
      System.out.println(o.getClass()); 
      System.out.println(o.getClass().getClassLoader()); 
    }
    catch (Exception e) {
      e.printStackTrace();
    }
    
    try {      
      System.out.println("With a null class loader"); 
      Object o = Class.forName("com.macfaq.net.www.content.text.tab", 
       true, null);
      System.out.println(o); 
      System.out.println(o.getClass()); 
      System.out.println(o.getClass().getClassLoader()); 
    }
    catch (Exception e) {
      e.printStackTrace();
    }
    
    try {      
      System.out.println("With the single argument forName method"); 
      Object o = Class.forName("com.macfaq.net.www.content.text.tab");
      System.out.println(o); 
      System.out.println(o.getClass()); 
      System.out.println(o.getClass().getClassLoader()); 
    }
    catch (Exception e) {
      System.out.println(e); 
      e.printStackTrace();
    }