Patch: add extensions directory contents to VMClassLoader class path.

Anthony Green green@redhat.com
Thu Jun 17 01:02:00 GMT 2004


This patch adds the contents of the extensions directories to the
VMClassLoader's class path.   They will appear just before core:/.

Ok?


2004-06-16  Anthony Green  <green@redhat.com>

	* gnu/gcj/runtime/VMClassLoader.java (init): Add extension
	contents to the class path.


Index: libjava/gnu/gcj/runtime/VMClassLoader.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/gnu/gcj/runtime/VMClassLoader.java,v
retrieving revision 1.12
diff -c -r1.12 VMClassLoader.java
*** libjava/gnu/gcj/runtime/VMClassLoader.java	14 Jan 2004 22:49:58 -0000	1.12
--- libjava/gnu/gcj/runtime/VMClassLoader.java	16 Jun 2004 23:42:34 -0000
***************
*** 57,62 ****
--- 57,94 ----
  	    /* 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


AG

-- 
Anthony Green <green@redhat.com>
Red Hat, Inc.



More information about the Java-patches mailing list