add java version
split cli and main (incomplete)