Fixes for build system.

- Depend on the protobuf-java version that protoc generates code for.
- Make JNI build more portable.