Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JNI help needed: adding jstrings to jobjectArray

 
Matt Senecal
Ranch Hand
Posts: 255
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm trying to add jstrings to a jobjectArray, but I keep getting ArrayStoreExceptions, and I can't figure out why.
The array is declared here:

The string I'm adding is a field from a C struct. The C struct is defined as:

I'm doing the conversion and add here:

And that's where the exception is thrown. As far as I can tell, this should work. Am I missing something?
 
Matt Senecal
Ranch Hand
Posts: 255
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This goes under the "dumb mistake" category. I was declaring the array to be:

Which is an array of String arrays. Oops! What I wanted was an array of Strings:
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic