• Post Reply Bookmark Topic Watch Topic
  • New Topic

problem while using JNI  RSS feed

 
sneha gupta
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I am passing a java class object from Jave to C thru JNI.
This object has many integer fields and one object of another class, which also has some fields.
I am able to read integer fields from C but not able to read fields inside another object.
Can anyone please help me in reading the object inside another object from C.
I am pasting class here for better understanding :

public class ImageMergeInformation {

public ImageInformation outputImageInfo;
public ImageInformation[] inputImageInfo = new ImageInformation[8];
public int topMargin;
public int bottomMargin;
}

I want to read ImageInformation obj.

Please help me...

Thanks in Advance,

Regards,
Sneha
 
Peter Chase
Ranch Hand
Posts: 1970
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You should read the JNI specification for answers to most JNI questions.

To work with a Java Object in JNI, you need to get its class with FindClass(). Then you need to find any methods you want to call, using GetMethodID(), and call them with methods like CallVoidMethod(). There is also GetFieldID() and things like GetIntField() for fields.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!