• Post Reply Bookmark Topic Watch Topic
  • New Topic

Invocation of add method of ArrayList object in JNI causes JVM restart  RSS feed

 
Jmaes nemanja
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to invoke the add method on an arrayList object in C using JNI. For some reason this is restarting JVM instance.

My code is something very similar to


I cant see any problem and no exceptions are thrown. Is there some memory leak problem I could have overlooked?

I can load this into a ObjectArray of a defined size in a similar fashion but I would like to use an ArrayList here as I will not know ahead of time the amount of array elements.
 
Rob Spoor
Sheriff
Posts: 21095
85
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please BeForthrightWhenCrossPostingToOtherSites: http://stackoverflow.com/questions/32456385/invocation-of-add-method-of-arraylist-object-via-jni-causes-jvm-restart

The problem was already found there (the missing -). This probably causes an error because instead of calling a function on the env object, you are comparing (*env) to CallBooleanMethod(env, arrayList, arrayClassAdd, myOjbject). It surprises me this even compiles because I assumed that CallBooleanMethod could not be found.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!