Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Jni – java native interface

2,280 views

Published on

How to interact with native code from Java

Published in: Self Improvement
  • Be the first to comment

Jni – java native interface

  1. 1. JNI – Java Native Interface How to persuade my Java application to talk to evil evil C native code
  2. 2. • WHAT? • WHY? • WHY NOT? • THE ACTUAL CODE • GOODIES
  3. 3. Er… WHAT? Java applications Native applications
  4. 4. But, but… WHY?
  5. 5. But, but… WHY? Allows native API function calls
  6. 6. But, but… WHY? Usage of existing native libraries
  7. 7. But, but… WHY? Execution of time-critical code
  8. 8. OK, so WHY NOT? Use of JNI should be avoided whenever reasonably possible!
  9. 9. Example Java native function declaration first:
  10. 10. Example
  11. 11. Example
  12. 12. Example
  13. 13. Example
  14. 14. Example
  15. 15. Example Careful!
  16. 16. Example
  17. 17. Example
  18. 18. Example
  19. 19. Exceptions?! Doable but annoying.
  20. 20. Other things to know • Forget about garbage collection • Java JVM is nazi about its memory space
  21. 21. I DON’T EXIST jernej@virag.si Skype: izacus

×