source: trunk/gcc/libjava/gnu/gcj/runtime/VMClassLoader.java

Last change on this file was 1392, checked in by bird, 21 years ago

This commit was generated by cvs2svn to compensate for changes in r1391,
which included commits to RCS files with non-trunk default branches.

  • Property cvs2svn:cvs-rev set to 1.1.1.2
  • Property svn:eol-style set to native
  • Property svn:executable set to *
File size: 1.9 KB
Line 
1/* Copyright (C) 1999, 2001, 2002 Free Software Foundation
2
3 This file is part of libgcj.
4
5This software is copyrighted work licensed under the terms of the
6Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
7details. */
8
9/* Author: Kresten Krab Thorup <krab@gnu.org> */
10
11package gnu.gcj.runtime;
12
13import java.io.*;
14import java.util.StringTokenizer;
15import java.net.URL;
16
17public final class VMClassLoader extends java.net.URLClassLoader
18{
19 private VMClassLoader ()
20 {
21 super (init());
22 }
23
24 private static URL[] init()
25 {
26 StringTokenizer st
27 = new StringTokenizer (System.getProperty ("java.class.path", "."),
28 System.getProperty ("path.separator", ":"));
29
30 java.util.Vector p = new java.util.Vector();
31 while (st.hasMoreElements ())
32 {
33 String e = st.nextToken ();
34 try
35 {
36 if (!e.endsWith (File.separator) && new File (e).isDirectory ())
37 p.addElement (new URL("file", "", -1, e + File.separator));
38 else
39 p.addElement (new URL("file", "", -1, e));
40 }
41 catch (java.net.MalformedURLException x)
42 {
43 /* Ignore this path element */
44 }
45 }
46 // Add core:/ to the end of the java.class.path so any resources
47 // compiled into this executable may be found.
48 try
49 {
50 p.addElement (new URL("core", "", -1, "/"));
51 }
52 catch (java.net.MalformedURLException x)
53 {
54 // This should never happen.
55 }
56
57 URL[] urls = new URL[p.size()];
58 p.copyInto (urls);
59 return urls;
60 }
61
62 /** This is overridden to search the internal hash table, which
63 * will only search existing linked-in classes. This will make
64 * the default implementation of loadClass (in ClassLoader) work right.
65 * The implementation of this method is in java/lang/natClassLoader.cc.
66 */
67 protected native Class findClass(String name)
68 throws java.lang.ClassNotFoundException;
69
70 // The only VMClassLoader that can exist.
71 public static VMClassLoader instance = new VMClassLoader ();
72}
Note: See TracBrowser for help on using the repository browser.