use Java to generate the test binary, many bug fixes