The windows batch script for sbt does not strip -J from lines in the
.sbtopts file, which can cause sbt to fail to run since they end up
getting passed in as unknown vm arguments.
I think this was inadvertently left out of
75257e759b. Prior to removing this,
`sbt --client exit` took about 200ms on my computer compared to about
50ms for sbtn. The sbt --client result dropped to about 80ms after this
change.
If there are strings in the path name, the sbt-script argument will be
interpreted as multiple arguments. The thin client also needs to be
updated to handle %20 in path names.
Passing the unsanitized arguments was problematic in sbt.bat because it
caused sbt --client to run sbtn with --client as a parameter. This
caused sbtn to launch sbt with the --client which caused a loop. This
manifested as a weird error about not being able to get the console
mode.
There are scenarios where sbt is not on the path and may be invoked as
an absolute path from the shell. When this is the case, sbtn will fail
to start a server because of the missing sbt on the path. We can fix
this by setting the --sbt-script parameter.
Before:
```
$ time sbt --client exit
[info] entering *experimental* thin client - BEEP WHIRR
[info] terminate the server with `shutdown`
sbt --client exit 0.16s user 0.15s system 101% cpu 0.303 total
```
sbt --client was running around 303ms (median out of 5) on my machine.
```
$ time sbtn exit
[info] entering *experimental* thin client - BEEP WHIRR
[info] terminate the server with `shutdown`
sbtn exit 0.05s user 0.05s system 112% cpu 0.085 total
```
On the other hand, sbtn ran in 85ms (median out of 5).
After:
```
$ time ~/work/sbt-modules/sbt-launcher-package/target/universal/stage/bin/sbt --client exit
[info] entering *experimental* thin client - BEEP WHIRR
[info] terminate the server with `shutdown`
~/work/sbt-modules/sbt-launcher-package/target/universal/stage/bin/sbt exit 0.06s user 0.08s system 111% cpu 0.127 total
```
By delaying the java version detection, I got it down to 127ms.
The script simply prints out each argument in an unambigous form on a single
line and handles to the `--version` option.
For windows, add `java.cmd` script which simply calls the former `java` script.
Using `--no-share` as a command line option resulted in a single additional
argument added to the java command:
`-Dsbt.global.base=project/.sbtboot -Dsbt.boot.directory=project/.boot -Dsbt.ivy.home=project/.ivy`
Actually, three separate arguments need to be added.