Skip to Main Content

Java HotSpot Virtual Machine

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Reading Java multidimensional array in C

843829Jun 3 2003 — edited Jun 5 2003
Hello friends.

Have searched the forum, but haven's found the answer.
I need to access a Java two dimensional array from C ( boolean[][] a; ).

Here's the code in C:
  jbooleanArray aArray;  
  jboolean **a;    
  fid=(*env)->GetFieldID(env, cls, "a", "[[Z");  
  if (fid==0) { return; }  aArray=(*env)->GetObjectField(env, jobj, fid);  
  len=(*env)->GetArrayLength(env, aArray);  
  a=(jboolean **) (*env)->GetBooleanArrayElements(env, aArray, 0);
Array lengths are correctly read separately. When I debug array in C it fails half-way or so:
  for (i=0;i<arows;i++)    
    for (j=0;j<acols;j++)       
      printf("a[%d][%d]=%u ",i,j,a<i>[j]);
Error: An unexpected exception has been detected in native code outside the VM.
Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at PC=0x189217B4

Is it the correct way to read multidimensional array? Or could it be the problem with jboolean type?

Kev
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 3 2003
Added on Jun 3 2003
3 comments
277 views