This tutorial will brief explain to you how to create a simple resource access between your Java VM code and native OS
What you will learn:
- Create a shared library in C containing simple basic functions and simple resource to access your system
- Create your JNI library in C to access your shared library
- Compile JNI shared library, access your custom class, throw an Exception or Throwable through native code
- Integrate JNI to your Java or Kotlin
- Create a documentation for C using Doxygen
- Create a documentation for Java using Javadoc
- Integrate tests
To create a native library in your OS system you need:
- Install a C compiler e.g.: gcc for unix system (Linux, Mac) or Visual Studio for Windows
- Install the latest version of Java 8 or 11 in your machine
- Clone this repository
- Run Make to compile this source code
- Run this example in your JVM
TODO ...
- Just type
cd <YOUR_PROJECT>/src/main/util && make
- To test your library
cd <YOUR_PROJECT>/src/main/util && make test
Just type in your src/main/util folder:
make clean
Sample example functions and used JNI functions are documented here
mailto: fabioegel@gmail.com
MIT