Move jni stuff to NativeInterface.

Makes it more generic and extensible for the future.