diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog index 1c38f50dfee..0c0430ec6b1 100644 --- a/gcc/java/ChangeLog +++ b/gcc/java/ChangeLog @@ -1,3 +1,8 @@ +2005-03-29 Tom Tromey + + * gcj.texi (libgcj Runtime Properties): Document + gnu.gcj.runtime.endorsed.dirs. + 2005-03-24 Anthony Green * gcj.texi (Invoking gcj-dbtool): Document new LIBDIR option to diff --git a/gcc/java/gcj.texi b/gcc/java/gcj.texi index 748597b8eb7..df693c057a0 100644 --- a/gcc/java/gcj.texi +++ b/gcc/java/gcj.texi @@ -2515,6 +2515,15 @@ search is done for each requested class. If this property is set to tried again. If this property is set to @samp{never}, then lookups are never done. For more information, @xref{Extensions}. +@item gnu.gcj.runtime.endorsed.dirs +This is like the standard @code{java.endorsed.dirs}, property, but +specifies some extra directories which are searched after the standard +endorsed directories. This is primarily useful for telling +@code{libgcj} about additional libraries which are ordinarily +incorporated into the JDK, and which should be loaded by the bootstrap +class loader, but which are not yet part of @code{libgcj} itself for +some reason. + @item gnu.gcj.jit.compiler @c FIXME we should probably have a whole node on this... This is the full path to @command{gcj} executable which should be diff --git a/libjava/ChangeLog b/libjava/ChangeLog index c5920719c29..98a04f697c8 100644 --- a/libjava/ChangeLog +++ b/libjava/ChangeLog @@ -1,3 +1,19 @@ +2005-03-29 Tom Tromey + + * java/lang/natRuntime.cc (insertSystemProperties): Set + gnu.gcj.runtime.endorsed.dirs. + * Makefile.in: Rebuilt. + * Makefile.am (ordinary_java_source_files): Added + HelperClassLoader.java. + (AM_CXXFLAGS): Define GCJ_ENDORSED_DIRS. + * gnu/gcj/runtime/VMClassLoader.java (VMClassLoader): Extends + HelperClassLoader. + (init): Use addDirectoriesFromProperty. + * gnu/gcj/runtime/BootClassLoader.java (BootClassLoader): Extends + HelperClassLoader. Use addDirectoriesFromProperty. Handle + gnu.gcj.runtime.endorsed.dirs. + * gnu/gcj/runtime/HelperClassLoader.java: New file. + 2005-03-26 Chris Burdess * gnu/xml/dom/DomNode.java (notifyNode): grow listener array as diff --git a/libjava/Makefile.am b/libjava/Makefile.am index ade95976c15..1694560a678 100644 --- a/libjava/Makefile.am +++ b/libjava/Makefile.am @@ -186,6 +186,7 @@ AM_CXXFLAGS = \ -DLIBDIR="\"$(libdir)\"" \ -DBOOT_CLASS_PATH="\"$(jardir)/$(jar_DATA)\"" \ -DJAVA_EXT_DIRS="\"$(jardir)/ext\"" \ + -DGCJ_ENDORSED_DIRS="\"$(jardir)/gcj-endorsed\"" \ -DLIBGCJ_DEFAULT_DATABASE="\"$(dbexecdir)/$(db_name)\"" \ -DLIBGCJ_DEFAULT_DATABASE_PATH_TAIL="\"$(db_pathtail)\"" \ -DTOOLEXECLIBDIR="\"$(toolexeclibdir)\"" @@ -2992,6 +2993,7 @@ gnu/gcj/io/SimpleSHSStream.java \ gnu/gcj/runtime/BootClassLoader.java \ gnu/gcj/runtime/FileDeleter.java \ gnu/gcj/runtime/FinalizerThread.java \ +gnu/gcj/runtime/HelperClassLoader.java \ gnu/gcj/runtime/JNIWeakRef.java \ gnu/gcj/runtime/NameFinder.java \ gnu/gcj/runtime/PersistentByteMap.java \ diff --git a/libjava/Makefile.in b/libjava/Makefile.in index 1c0508c325f..d91dcf23fe2 100644 --- a/libjava/Makefile.in +++ b/libjava/Makefile.in @@ -550,6 +550,7 @@ am__libgcj0_convenience_la_SOURCES_DIST = prims.cc jni.cc exception.cc \ gnu/gcj/runtime/BootClassLoader.java \ gnu/gcj/runtime/FileDeleter.java \ gnu/gcj/runtime/FinalizerThread.java \ + gnu/gcj/runtime/HelperClassLoader.java \ gnu/gcj/runtime/JNIWeakRef.java \ gnu/gcj/runtime/NameFinder.java \ gnu/gcj/runtime/PersistentByteMap.java \ @@ -3554,6 +3555,7 @@ am__objects_15 = $(am__objects_9) gnu/classpath/ServiceFactory.lo \ gnu/gcj/runtime/BootClassLoader.lo \ gnu/gcj/runtime/FileDeleter.lo \ gnu/gcj/runtime/FinalizerThread.lo \ + gnu/gcj/runtime/HelperClassLoader.lo \ gnu/gcj/runtime/JNIWeakRef.lo gnu/gcj/runtime/NameFinder.lo \ gnu/gcj/runtime/PersistentByteMap.lo \ gnu/gcj/runtime/SharedLibHelper.lo \ @@ -4568,6 +4570,7 @@ AM_CXXFLAGS = \ -DLIBDIR="\"$(libdir)\"" \ -DBOOT_CLASS_PATH="\"$(jardir)/$(jar_DATA)\"" \ -DJAVA_EXT_DIRS="\"$(jardir)/ext\"" \ + -DGCJ_ENDORSED_DIRS="\"$(jardir)/gcj-endorsed\"" \ -DLIBGCJ_DEFAULT_DATABASE="\"$(dbexecdir)/$(db_name)\"" \ -DLIBGCJ_DEFAULT_DATABASE_PATH_TAIL="\"$(db_pathtail)\"" \ -DTOOLEXECLIBDIR="\"$(toolexeclibdir)\"" @@ -6752,6 +6755,7 @@ gnu/gcj/io/SimpleSHSStream.java \ gnu/gcj/runtime/BootClassLoader.java \ gnu/gcj/runtime/FileDeleter.java \ gnu/gcj/runtime/FinalizerThread.java \ +gnu/gcj/runtime/HelperClassLoader.java \ gnu/gcj/runtime/JNIWeakRef.java \ gnu/gcj/runtime/NameFinder.java \ gnu/gcj/runtime/PersistentByteMap.java \ @@ -9045,6 +9049,8 @@ gnu/gcj/runtime/FileDeleter.lo: gnu/gcj/runtime/$(am__dirstamp) \ gnu/gcj/runtime/$(DEPDIR)/$(am__dirstamp) gnu/gcj/runtime/FinalizerThread.lo: gnu/gcj/runtime/$(am__dirstamp) \ gnu/gcj/runtime/$(DEPDIR)/$(am__dirstamp) +gnu/gcj/runtime/HelperClassLoader.lo: gnu/gcj/runtime/$(am__dirstamp) \ + gnu/gcj/runtime/$(DEPDIR)/$(am__dirstamp) gnu/gcj/runtime/JNIWeakRef.lo: gnu/gcj/runtime/$(am__dirstamp) \ gnu/gcj/runtime/$(DEPDIR)/$(am__dirstamp) gnu/gcj/runtime/NameFinder.lo: gnu/gcj/runtime/$(am__dirstamp) \ @@ -14849,6 +14855,8 @@ mostlyclean-compile: -rm -f gnu/gcj/runtime/FileDeleter.lo -rm -f gnu/gcj/runtime/FinalizerThread.$(OBJEXT) -rm -f gnu/gcj/runtime/FinalizerThread.lo + -rm -f gnu/gcj/runtime/HelperClassLoader.$(OBJEXT) + -rm -f gnu/gcj/runtime/HelperClassLoader.lo -rm -f gnu/gcj/runtime/JNIWeakRef.$(OBJEXT) -rm -f gnu/gcj/runtime/JNIWeakRef.lo -rm -f gnu/gcj/runtime/NameFinder.$(OBJEXT) @@ -19822,6 +19830,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@gnu/gcj/runtime/$(DEPDIR)/BootClassLoader.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@gnu/gcj/runtime/$(DEPDIR)/FileDeleter.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@gnu/gcj/runtime/$(DEPDIR)/FinalizerThread.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@gnu/gcj/runtime/$(DEPDIR)/HelperClassLoader.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@gnu/gcj/runtime/$(DEPDIR)/JNIWeakRef.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@gnu/gcj/runtime/$(DEPDIR)/NameFinder.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@gnu/gcj/runtime/$(DEPDIR)/PersistentByteMap.Plo@am__quote@ diff --git a/libjava/gnu/gcj/runtime/BootClassLoader.java b/libjava/gnu/gcj/runtime/BootClassLoader.java index e25f21f8841..d2091720a4f 100644 --- a/libjava/gnu/gcj/runtime/BootClassLoader.java +++ b/libjava/gnu/gcj/runtime/BootClassLoader.java @@ -8,14 +8,9 @@ details. */ package gnu.gcj.runtime; -import java.io.File; -import java.io.FilenameFilter; import java.io.IOException; import java.net.URL; -import java.net.URLClassLoader; import java.util.Enumeration; -import java.util.HashSet; -import java.util.StringTokenizer; /** * This is a helper for the bootstrap class loader. It is a @@ -24,37 +19,18 @@ import java.util.StringTokenizer; * However, it is never called the way that an ordinary ClassLoader is * called. For instance, loadClass() is never used. */ -public final class BootClassLoader extends URLClassLoader +public final class BootClassLoader extends HelperClassLoader { BootClassLoader(String libdir) { - super(new URL[0]); + addDirectoriesFromProperty("java.endorsed.dirs"); + addDirectoriesFromProperty("gnu.gcj.runtime.endorsed.dirs"); - // Add the contents of the endorsed directories. - StringTokenizer st - = new StringTokenizer (System.getProperty ("java.endorsed.dirs", ""), - File.pathSeparator); try { - while (st.hasMoreElements ()) - { - String dirname = st.nextToken (); - File dir = new File (dirname); - if (dir.exists ()) - { - 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])); - } - } + // Add core:/ to the end so any resources compiled into this + // executable may be found. + addURL(new URL("core", "", -1, "/")); } catch (java.net.MalformedURLException x) { diff --git a/libjava/gnu/gcj/runtime/VMClassLoader.java b/libjava/gnu/gcj/runtime/VMClassLoader.java index 1ded892a06d..1ed0c026cf8 100644 --- a/libjava/gnu/gcj/runtime/VMClassLoader.java +++ b/libjava/gnu/gcj/runtime/VMClassLoader.java @@ -10,20 +10,16 @@ details. */ package gnu.gcj.runtime; -import java.io.*; -import java.util.StringTokenizer; -import java.util.HashSet; import java.net.URL; -import java.net.URLClassLoader; +import java.util.HashSet; // Despite its name, this class is really the extension loader for // libgcj. Class loader bootstrap is a bit tricky, see prims.cc and // SystemClassLoader for some details. -public final class VMClassLoader extends URLClassLoader +public final class VMClassLoader extends HelperClassLoader { private VMClassLoader () { - super (new URL[0]); String p = System.getProperty ("gnu.gcj.runtime.VMClassLoader.library_control", ""); @@ -39,44 +35,7 @@ public final class VMClassLoader extends URLClassLoader private void init() { - // Add the contents of the extensions directories. - StringTokenizer st - = new StringTokenizer (System.getProperty ("java.ext.dirs"), - File.pathSeparator); - - try - { - while (st.hasMoreElements ()) - { - String dirname = st.nextToken (); - File dir = new File (dirname); - if (dir.exists ()) - { - 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])); - } - } - - // Add core:/ to the end so any resources compiled into this - // executable may be found. - addURL(new URL("core", "", -1, "/")); - } - catch (java.net.MalformedURLException x) - { - // This should never happen. - throw new RuntimeException(x); - } + addDirectoriesFromProperty("java.ext.dirs"); } /** This is overridden to search the internal hash table, which diff --git a/libjava/java/lang/natRuntime.cc b/libjava/java/lang/natRuntime.cc index 56385442da4..248bf44b89c 100644 --- a/libjava/java/lang/natRuntime.cc +++ b/libjava/java/lang/natRuntime.cc @@ -528,6 +528,11 @@ java::lang::Runtime::insertSystemProperties (java::util::Properties *newprops) // The java extensions directory. SET ("java.ext.dirs", JAVA_EXT_DIRS); + // The endorsed directories that libgcj knows about by default. + // This is a way to get other jars into the boot class loader + // without overriding java.endorsed.dirs. + SET ("gnu.gcj.runtime.endorsed.dirs", GCJ_ENDORSED_DIRS); + // The path to libgcj's boot classes SET ("sun.boot.class.path", BOOT_CLASS_PATH);