Refactor java packaging.