[kaffe] A question about "JNI_OnLoad"
embstudy at eyou.com
embstudy at eyou.com
Tue Jul 20 01:04:21 PDT 2004
Hello
This is the cmd I used:
______________________________________________________________________________
__
# kaffe -v -vmdebug AWT,NATIVELIB -ss 128600 -cp $PWD Calc
------------------------------------------------------------------------------
--
And I got the following errors:
++++++++++++++++++++++++++++++
Native lib /cvs/xscale/jre/lib/arm/libnative
LOAD desc=0xb42d0 index=0 ++ref=1
Couldn't find JNI_OnLoad in library handle 0 == libnative.
Error message is /cvs/xscale/jre/lib/arm/libkaffevm-1.1.x-cvs.so: undefined
symbol: JNI_OnLoad.
Loading java/lang/Object.class(/cvs/xscale/jre/lib/rt.jar) [compressed]
Loading java/io/Serializable.class(/cvs/xscale/jre/lib/rt.jar) [compressed]
...
ading kaffe/io/StdErrorStream.class(/cvs/xscale/jre/lib/rt.jar) [compressed]
Loading java/io/FileInputStream.class(/cvs/xscale/jre/lib/rt.jar)
[compressed]
Loading java/io/FileDescriptor.class(/cvs/xscale/jre/lib/rt.jar)
[compressed]
Loading java/io/FileOutputStream.class(/cvs/xscale/jre/lib/rt.jar)
[compressed]
Method =
java/lang/System.initProperties(Ljava/util/Properties;)Ljava/util/Properties;
Native stub = 'java_lang_System_initProperties'
Found java_lang_System_initProperties in library handle 0 == libnative.
Internal error: caught an unexpected exception.
Please check your CLASSPATH and your installation.
java/lang/NullPointerException
at java.lang.System.initProperties(System.java:native)
at java.lang.System.<clinit>(System.java:43)
at java.lang.ClassLoader.<init>(ClassLoader.java:115)
at java.lang.ClassLoader.<init>(ClassLoader.java:111)
at java.security.SecureClassLoader.<init>(SecureClassLoader.java:59)
at java.net.URLClassLoader.<init>(URLClassLoader.java:544)
at kaffe.lang.AppClassLoader.<init>(AppClassLoader.java:237)
Aborted
------------------------------------------------------------------------------
---
I am not sure what caused my program to Aborted now.
Maybe anyone knows?
But the "Error message" :
|Couldn't find JNI_OnLoad in library handle 0 == libnative.
|Error message is /cvs/xscale/jre/lib/arm/libkaffevm-1.1.x-cvs.so:
|undefined symbol: JNI_OnLoad.
always exists.
Then I try to make sure what really happened to the symbol 'JNI_OnLoad'.
Step 1. #cd kaffe
#find * -exec grep -inH "JNI_On" {} \;
+++--------------------------------------------------------------------
ChangeLog.6:952: * kaffe/kaffevm/external.c
(loadNativeLibrary2) Call JNI_OnLoad
include/jni.h:196:JNIEXPORT jint JNICALL JNI_OnLoad (JavaVM *, void
*);
include/jni.h:197:JNIEXPORT void JNICALL JNI_OnUnload (JavaVM *, void
*);
kaffe/kaffevm/external.c:380: func =
loadNativeLibrarySym("JNI_OnLoad");
kaffe/kaffevm/external.c:383: /* Call JNI_OnLoad */
Binary file kaffe/kaffevm/.libs/external.o matches
Binary file kaffe/kaffevm/.libs/libkaffevm-1.1.x-cvs.so matches
Binary file kaffe/kaffevm/.libs/libkaffevm.so matches
Binary file kaffe/kaffevm/.libs/libkaffevm-1.1.x-cvs.soT matches
+++---------------------------------------------------------------------
Step 2. From Step1 we can make sure that there is only two source file
contains the symbol "JNI_OnLoad".
#vi include/jni.h
+++---------------------------------------------------------------------
/* These functions might be defined in libraries which we load; the
JNI implementation calls them at the appropriate times. */
JNIEXPORT jint JNICALL JNI_OnLoad (JavaVM *, void *);
JNIEXPORT void JNICALL JNI_OnUnload (JavaVM *, void *);
+++----------------------------------------------------------------------
#vi kaffe/kaffevm/external.c
+++----------------------------------------------------------------------
func = loadNativeLibrarySym("JNI_OnLoad");
if (func != NULL) {
JavaVM *jvm = &Kaffe_JavaVM;
/* Call JNI_OnLoad */
((jint(JNICALL *)(JavaVM *, void *))func)(jvm, NULL);
}
+++----------------------------------------------------------------------
Step 3. From Step2 we know that "JNI_OnLoad" is not realized now in kaffe.
So I think the "Error Message" means that:
+++----------------------------------------------------------------------
libkaffevm-1.1.x-cvs.so loads the func
"func = loadNativeLibrarySym("JNI_OnLoad")" from the libnative,but
there
is no such a func there in libnative. Because even we couldn't
find such a symbol named "JNI_OnLoad" at the libnative.
+++----------------------------------------------------------------------
Could anyone point out the trick for me?
cheers
Saw
--http://www.eyou.com
--Îȶ¨¿É¿¿µÄµç×ÓÐÅÏä ÓïÒôÓʼþ Òƶ¯ÊéÇ© ÈÕÀú·þÎñ ÍøÂç´æ´¢...ÒÚÓÊδ¾¡
--http://vip.eyou.com
--¿ì¿ìµÇ¼ÒÚÓÊVIPÐÅÏä ×¢²áÄúÖÐÒâµÄÓû§Ãû
More information about the kaffe
mailing list