This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Patch: RFA for 4.0: use system class loader


Hi,

On Sat, 2005-04-16 at 15:08 -0600, Tom Tromey wrote:
> >>>>> "Per" == Per Bothner <per@bothner.com> writes:
> 
> Per> This should go into 4.0, right?  It's not there yet.
> 
> I think Mark W. is still waiting for approval from Mark M.

No, that was just a "this seems to work for me and is probably kind of
right" patch. Here is the patch that I would propose if people want it
on mainline and/or the 4.0 branch.

I have now discussed it a bit on irc with some people and Andrew pointed
out that all ways to set the system class loader path should behave the
same, whether done through pre-compiled main-class or through
interpreted/bc-compiled gij launcher.

In gij.cc we actually transform the -classpath argument into a
-Djava.class.path for the invocation API. To keep this patch as simple
as possible (when we want to include it in 4.0) I didn't change any of
the logic in gij.cc or prims.cc. This just looks at whether or not the
system property is already set, whether or not to use the CLASSPATH
environment variable and falls back to "." when not set or set to the
empty string.

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

        * java/lang/natRuntime.cc (insertSystemProperties): Set
        java.class.path to CLASSPATH only when not empty. Fall back to
        default path "." when java.class.path is empty.

Clean build has good make check results (x86 Debian GNU/Linux branch and
mainline). kawa make and testsuite make check (pre-compiled) work out of
the box. Eclipse (interpreted and bc-compiled) works fine.

OK for mainline and 4.0 branch?

Cheers,

Mark

Index: java/lang/natRuntime.cc
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/lang/natRuntime.cc,v
retrieving revision 1.47.2.6
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     16 Apr 2005 10:23:54 -0000
@@ -620,13 +620,20 @@
   // CLASSPATH environment variable if given.  See gij.cc main () and
   // prims.cc _Jv_CreateJavaVM () for all the ways this could have
   // been set much earlier.
+  // If CLASSPATH isn't set or if the path is empty fall back to "."
   path = newprops->getProperty(JvNewStringLatin1("java.class.path"));
   if (!path)
     {
       char *classpath = getenv("CLASSPATH");
-      if (classpath)
-       SET ("java.class.path", classpath);
+      if (classpath && classpath[0] != 0)
+       {
+         path = JvNewStringLatin1 (classpath);
+         newprops->put(JvNewStringLatin1 ("java.class.path"), path);
+       }
     }
+
+  if (!path || path->length() == 0)
+    SET ("java.class.path", ".");
 }

 java::lang::Process *

Attachment: signature.asc
Description: This is a digitally signed message part


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]