1 /* Copyright (C) 2005 Free Software Foundation
3 This file is part of libgcj.
5 This software is copyrighted work licensed under the terms of the
6 Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
9 package gnu.gcj.runtime;
11 import java.io.IOException;
13 import java.util.Enumeration;
16 * This is a helper for the bootstrap class loader. It is a
17 * URLClassLoader so that we can read a class path and re-use all the
18 * existing code for finding classes, extracting them from jars, etc.
19 * However, it is never called the way that an ordinary ClassLoader is
20 * called. For instance, loadClass() is never used.
22 public final class BootClassLoader extends HelperClassLoader
24 BootClassLoader(String libdir)
26 addDirectoriesFromProperty("java.endorsed.dirs");
27 addDirectoriesFromProperty("gnu.gcj.runtime.endorsed.dirs");
31 // Add core:/ to the end so any resources compiled into this
32 // executable may be found.
33 addURL(new URL("core", "", -1, "/"));
35 catch (java.net.MalformedURLException x)
37 // This should never happen.
38 throw new RuntimeException(x);
42 public Class bootLoadClass(String name)
43 throws ClassNotFoundException
45 Class c = findLoadedClass(name);
50 // We could hack URLClassLoader to make this more
51 // efficient, if it mattered.
54 catch (ClassNotFoundException _)
62 public URL bootGetResource(String name)
64 return findResource(name);
67 public Enumeration bootGetResources(String name) throws IOException
69 return findResources(name);