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 // The BootClassLoader is the top of the delegation chain. It does not
28 super((ClassLoader
) null);
29 addDirectoriesFromProperty("java.endorsed.dirs");
30 addDirectoriesFromProperty("gnu.gcj.runtime.endorsed.dirs");
34 // Add core:/ to the end so any resources compiled into this
35 // executable may be found.
36 addURL(new URL("core", "", -1, "/"));
38 catch (java
.net
.MalformedURLException x
)
40 // This should never happen.
41 throw new RuntimeException(x
);
45 public Class
bootLoadClass(String name
)
46 throws ClassNotFoundException
48 Class c
= findLoadedClass(name
);
53 // We could hack URLClassLoader to make this more
54 // efficient, if it mattered.
57 catch (ClassNotFoundException _
)
65 public URL
bootGetResource(String name
)
67 return findResource(name
);
70 public Enumeration
bootGetResources(String name
) throws IOException
72 return findResources(name
);