Finalize build scripts
Fixing a bug on wrong java env