Not nearly enough error checking here. You need to check the result of every JNI call: specifically, GetClass() and GetMethodID() could both have failed, yet you went ahead with CallStaticMethod() anyway. Don't do that.

In any case you are passing a NULL to a method that is complaining about a NullPointerException. I suggest you don't do that either.

that is a memory overflow problem, somewhere some code is writing into memory it shouldn't be writing into; think of writing to an array index outside of the boundaries of the array size for example. Java does a nice boundary check for you, but in native code you're on your own. That can be any code causing the problem, not specifically there where you were just hacking something together. Perhaps you can figure something out by spamming some printfs to at least know which code is touched last.