JNIEnv->FindClass(JNIEnv *env, const char *name), initialize class?

Marco Trudel mtrudel@gmx.ch
Tue Dec 12 19:01:00 GMT 2006


Tom Tromey wrote:
>>>>>> "David" == David Daney <ddaney@avtrex.com> writes:
>>>> static { } blocks won't be called when a class is loaded in a JNI
>>> function via JNIEnv->FindClass(...). But they will be executed on a
>>> Sun JVM.
>>> Is an example needed? Is this a GCJ issue? Ideas?
>> David> A small test case would be useful.
>> Yeah, please write it in a form where we can drop it into the
> libjava.jni test suite.

Here you go. Main.java calls searchClass.cpp which runs 
FindClass("ClassToFind").
The output with a Sun JVM is:
 > Hello...
 > "Hello..." should have been printed.
 From a GCJ compiled application:
 > "Hello..." should have been printed.
Sorry, I'm not (yet) familiar with Mauve and work currently on Windows. 
I hope this will do it anyway...
> If this is a bug it looks like the fix will be a one line change in
> jni.cc:_Jv_JNI_FindClass.

Yes, I thought so :-)
thanks
Marco
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: searchClass.cpp
URL: <http://gcc.gnu.org/pipermail/java/attachments/20061212/4f90c6ee/attachment.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: Main.java
URL: <http://gcc.gnu.org/pipermail/java/attachments/20061212/4f90c6ee/attachment-0001.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: ClassToFind.java
URL: <http://gcc.gnu.org/pipermail/java/attachments/20061212/4f90c6ee/attachment-0002.ksh>


More information about the Java mailing list

AltStyle によって変換されたページ (->オリジナル) /