Java version of cc_main.cpp