Move some logic into jvmlauncher
Move some more logic to jvmlauncher. Fix some bugs.