This week's book giveaway is in the Design forum.
We're giving away four copies of Building Microservices and have Sam Newman on-line!
See this thread for details.
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


Win a copy of Building Microservices this week in the Design forum!
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
 
It's not a secret anymore!