Contents

Cover
Introduction
recipe № 001 running simple JNI code
recipe № 002 passing int value from Java to C
recipe № 003 passing double value from Java to C
recipe № 004 passing long value from Java to C
recipe № 005 passing short value from Java to C
recipe № 006 passing char value from Java to C
recipe № 007 passing byte value from Java to C
recipe № 008 passing boolean value from Java to C
recipe № 009 passing java.lang.String value from Java to C
recipe № 010 passing java.lang.String value from C to Java
recipe № 011 passing primitive types from C to Java
recipe № 012 passing primitives array from Java to C
recipe № 013 passing primitives array from Java to C and back (commit changes)
recipe № 014 passing memory allocated in C back to Java
recipe № 015 handling SIGSEGV/SIGBUS in JNI code (stop JVM from crashing)
recipe № 016 handling exit calls from external library called via JNI (atexit)
recipe № 017 handling exit calls from external library called via JNI (-Dexit)
recipe № 018 dynamic loading of library in JNI
recipe № 019 throwing exception from C code
recipe № 020 accessing fields of object passed as argument
recipe № 021 calling code from another source file (adapter pattern)
recipe № 022 running Java as daemon – main daemon’s loop in the C
recipe № 023 calling code from shared library (adapter pattern)
recipe № 024 calling JNI methods from Threads and how to debug them using gdb
recipe № 027 calling class methods from multiple threads
recipe № 029 running Java as daemon – main daemon’s loop in Java
recipe № 030 Abstract method and native implementation
recipe № D001 debugging JNI code with CLion
recipe № D002 debugging JNI code with IntelliJ and CLion
Appendix A