Preliminary work on the JNI layer.