JNI fixes, added missing JNIEXPORT / JNICALL declarations

This is needed if compiling with custom visibility settings (example :
-fvisibility=hidden)
Merge pull request #2296 from rtissera/jni_fixes

fixed #1996: JNI fixes, added missing JNIEXPORT / JNICALL declarations