Kaffe 0.10.0 on Linux

George Ronkin gronkin at sequoia.nerdvana.com
Sat Apr 25 13:49:54 PDT 1998


zun at falconwing.com said:
> I get the following
> java.lang.NoSuchMethodError: initializeSystemClass 

Hi,
	The java.lang.System.class with both SBB Linux X86 JDK 1.1.5s
that I've seen does in fact not have initializeSystemClass.  Tim
emailed me that the SPARC Solaris JDK 1.1.5 classes.zip he tested with
did.  Obviously I don't doubt him, so I don't know the reason why
the two classes.zip should be different.
	In any event, I got 0.10.0 to work in the sense of passing
basic tests, running javac, and some code I was writing by changing
kaffe/kaffevm/baseClasses.c to not call initializeSystemClass if
it didn't exist:

Index: kaffe/kaffevm/baseClasses.c
===================================================================
RCS file: /archive1/cvsroot/kaffe/kaffe/kaffevm/baseClasses.c,v
retrieving revision 1.1.1.4
retrieving revision 1.2
diff -u -r1.1.1.4 -r1.2
- --- baseClasses.c	1998/04/12 03:30:01	1.1.1.4
+++ baseClasses.c	1998/04/13 18:23:54	1.2
@@ -28,6 +28,7 @@
 #include "exception.h"
 #include "itypes.h"
 #include "md.h"
+#include "support.h"
 
 Utf8Const* init_name;
 Utf8Const* void_signature;
@@ -74,6 +75,9 @@
 /*
  * Initialise the machine.
  */
+static char *initMeth = "initializeSystemClass";	/* GR */
+static char *initSig = "()V";
+
 void
 initialiseKaffe(void)
 {
@@ -109,7 +113,17 @@
 	initThreads();
 
 	/* Initialise the System */
- -	do_execute_java_class_method("java.lang.System", "initializeSystemClass", 
"()V");
+	/* 
+	 * Only do this if the method exists -
+	 * in older versions it doesn't  - GR.
+	 */
+	meth = lookupClassMethod(lookupClass("java/lang/System"),
+			       initMeth, initSig);
+
+	/* Method must be static to invoke it here */
+	if (meth && (meth->accflags & ACC_STATIC))
+	  do_execute_java_class_method("java.lang.System",
+				       initMeth, initSig);
 }
 
 /*


(Fair warning - I generated this patch from my change, but haven't
actually applied it back to the original 0.10.0 source to verify it.)

With this patch (BTW, I had to do a "make clean" to ensure that the
kaffe executable itself was re-linked), and appropriate
KAFFE_CLASSPATH and KAFFEHOME values, the "kaffe HelloWorldApp" now
works, the test/regression/TestScript tests now compile with kjavac
and pass, and a small antlr grammar and AST builder I've been playing
with now run properly with kaffe as well.  This does not prove that by 
omitting this method where it didn't exist, I didn't neglect to do
something else I should have done instead.  (Just a warning you should 
look at this before using it, because I might not know any better.)
As of a snapshot from April 9 or so, there were no relevant changes.
I have not looked at a more recent snapshot.

	As for the Linux classes.zip not having initializeSystemClass,
is this an error in the Linux JDK ports, or is there a different
explanation?
	Thanks for any light shed,
-- 
	George Ronkin





More information about the kaffe mailing list