update cleanup script

update cleanup script, change position of some code.
Merge pull request #17 from StanleyShen/java_start

Merged.