jQuery in Action, 2nd edition*
The moose likes Other JSE/JEE APIs and the fly likes JNI help needed: adding jstrings to jobjectArray Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Other JSE/JEE APIs
Bookmark "JNI help needed: adding jstrings to jobjectArray" Watch "JNI help needed: adding jstrings to jobjectArray" New topic
Author

JNI help needed: adding jstrings to jobjectArray

Matt Senecal
Ranch Hand

Joined: Dec 01, 2000
Posts: 255
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?


There's nothing more dangerous than a resourceful idiot. ---Dilbert
Matt Senecal
Ranch Hand

Joined: Dec 01, 2000
Posts: 255
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:
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JNI help needed: adding jstrings to jobjectArray