Patch: RFA for 4.0: use system class loader

Mark Wielaard mark@klomp.org
Thu Apr 14 23:18:00 GMT 2005


Hi,

On Thu, 2005-04-14 at 15:37 -0700, Per Bothner wrote:
> Doing a
>    CLASSPATH=. make classes2.class
> works.  The classloader is:
> gnu.gcj.runtime.SystemClassLoader{urls=[], 
> parent=gnu.gcj.runtime.ExtensionClassLoader{urls=[], parent=null}}
> 
> Shouldn't "." be in the default CLASSPATH, if not specified?

Yes. The order is -jar overrides -classpath overrides -Djava.class.path
overrides CLASSPATH environment overrides default value ".".

In your Makefile you set CLASSPATH to the empty string and we dutifully
use an empty class path in the system classloader.

With the following patch in place make check in kawa testsuites seems to
pass all tests.

2005-04-15  Mark Wielaard  <mark@klomp.org>

        * java/lang/natRuntime.cc (insertSystemProperties): Set
        java.class.path to "." if CLASSPATH not given or empty.

Do you think we should handle the case were CLASSPATH is set to the
empty string in this way?

Cheers,

Mark

diff -u -r1.47.2.6 natRuntime.cc
--- java/lang/natRuntime.cc     13 Apr 2005 21:36:55 -0000      1.47.2.6
+++ java/lang/natRuntime.cc     14 Apr 2005 23:16:35 -0000
@@ -624,8 +624,10 @@
   if (!path)
     {
       char *classpath = getenv("CLASSPATH");
-      if (classpath)
+      if (classpath && classpath[0] != 0)
        SET ("java.class.path", classpath);
+      else
+       SET ("java.class.path", ".");
     }
 }

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <http://gcc.gnu.org/pipermail/java-patches/attachments/20050414/06e62eef/attachment.sig>


More information about the Java-patches mailing list