fix up the script so that it actually installs java and is slightly more efficent