OSDN Git Service

Add extension directory contents to the class path.
authorgreen <green@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 17 Jun 2004 13:30:32 +0000 (13:30 +0000)
committergreen <green@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 17 Jun 2004 13:30:32 +0000 (13:30 +0000)
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@83291 138bc75d-0d04-0410-961f-82ee72b054a4

libjava/ChangeLog
libjava/gnu/gcj/runtime/VMClassLoader.java

index 299ec1c..1ff76e2 100644 (file)
@@ -1,3 +1,8 @@
+2004-06-17  Anthony Green  <green@redhat.com>
+
+       * gnu/gcj/runtime/VMClassLoader.java (init): Add extension
+       directory contents to the class path.
+
 2004-06-15  Andrew Haley  <aph@redhat.com>
 
        * java/lang/natSystem.cc (getenv0): Don't assume environment
index 3eabd73..75d193b 100644 (file)
@@ -57,6 +57,36 @@ public final class VMClassLoader extends java.net.URLClassLoader
            /* Ignore this path element */
          }
       }
+
+    // Add the contents of the extensions directories.  
+    st = new StringTokenizer (System.getProperty ("java.ext.dirs"),
+                             System.getProperty ("path.separator", ":"));
+    while (st.hasMoreElements ())
+      {
+       String dirname = st.nextToken ();
+       try
+         {
+           File dir = new File (dirname);
+           if (! dirname.endsWith (File.separator))
+               dirname = dirname + File.separator;
+           String files[] 
+             = dir.list (new FilenameFilter ()
+                         { 
+                           public boolean accept (File dir, String name)
+                           {
+                             return (name.endsWith (".jar") 
+                                     || name.endsWith (".zip"));
+                           }
+                         });
+           for (int i = files.length - 1; i >= 0; i--)
+             addURL(new URL("file", "", -1, dirname + files[i]));
+         }
+       catch (Exception x)
+         {
+           // Just ignore any badness.  
+         }
+      }
+
     // Add core:/ to the end of the java.class.path so any resources
     // compiled into this executable may be found.
     try