Launcher: heed the JRE setting in legacy ImageJ.cfg

The second line of the (not very well-documented) ImageJ.cfg format
is supposed to specify the path to javaw.exe.

If it points to java.exe instead, the launcher is expected to open
a console.

This entails basically a rewrite of the parse_legacy_config() function
since we used to only ever look at the third line. As a bonus, we
handle the case correctly now where ImageJ options were specified
after the main class.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Launcher: heed the ImageJ options in legacy ImageJ.cfg

The third line of ImageJ.cfg specifies not only the Java options,
but optionally ImageJ options after the class name, e.g. '-debug'. For
backwards-compatibility, we want to support that, too.

Asked-for by Wayne Rasband.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Launcher: show the command-line in verbose mode

In contrast to the dry-run mode, we go forward and run with said
command-line, though.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Launcher (Windows): open the console upon fatal errors

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Launcher: be more quiet by default again

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Launcher: write an ImageJ.cfg when launched in ImageJ 1.x mode

As pointed out by Wayne Rasband, the Edit>Options>Memory &
Threads... command relies on a valid ImageJ.cfg to be written into
the ImageJ directory. So write one if one does not exist already.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Launcher (Windows): fix falling back to JAVA_HOME

Somehow the ability was lost to fall back to launching Java as
specified by the environment variable JAVA_HOME.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Launcher: be more verbose about the amount of reserved heap

Hopefully this will help Wayne to diagnose the erroneous allocation
on his laptop.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Launcher (Windows): fix annoying compiler warning

Somehow, MinGW compilers find it funny to be inconsistent about the
execve() signature.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Launcher: when all else fails, look into JAVA_HOME or JRE_HOME

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Merge branch 'ij-launcher'

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>

Conflicts:
	core/launcher/src/main/c/ImageJ.c