Implemented mainloop on Java.
Changed to build jar by default.