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!

How use SetIntArrayRegion with std::vector<int>?

843829Nov 15 2006 — edited Nov 16 2006
I have a vector of ints that i want to put into a jintArray. How do I do this?

When I tried the below code, it didn't work but instead when i printed out the int values on the java side, they were all messed up.
jintArray arr = env->NewintArray( intVector.size() );
env->SetintArrayRegion( arr, 0, intVector.size(), ( jint * ) &( intVector ) );
This returns weird values. What am I doing wrong?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 14 2006
Added on Nov 15 2006
6 comments
1,271 views