a relatively stable pair-end version with JNI