3

I'm using JNI to pass an image from C++ to Java, im trying to send the bytes in a jbyteArray over to Java in byte[]. However I'm getting an error which has most likely have to do something with the size of the bytes being send.

I have tried int len = dwBmpSize which have the same value but the jvm keeps crashing.

What is the correct amount of bytes to initialize the jbyteArray with?

MicroHat11
  • 227
  • 3
  • 12
  • 1
    1) You didn't check if `GlobalAlloc` failed. 2) You should take the `min` of what you allocated and `bi.biSizeImge` and use that value to initialize and copy the bytes in to the jbyteArray. – PaulMcKenzie Jun 15 '15 at 15:06

0 Answers0