Build C++ JNI shared library mkdir build cd build cmake ../ make Compile the Java file cd ../ javac JNIJavaSample.java Run the Java class java - -Djava.library.path=./build JNIJavaSample Run using the sh file chmod +x build_n_run.sh ./build_n_run.sh