Java version add arguments, JSON output etc.

This patchset lifts the Java version to the same feature set level as the C++ and Go version.