Always pass -batch when --headless is given

The previous logic only appended -batch under certain conditions. The
intended use case was when passing .ijm files for execution, but the
check was rather fragile. Really, we should just always pass -batch in
the case of --headless when the main class is ij.ImageJ or fiji.Main.

Normally, the -batch flag requires a follow-on argument specifying the
macro or script to execute. Only when the -batch flag is the final
argument to ImageJ does it relent and disable the GUI without requiring
a corresponding macro or script file to run. So we must take care to
ensure that -batch is only appended as the final argument, and only if
-batch does not also appear elsewhere already.

With this change, the following invocation now works:

    ./ImageJ-linux64 --headless -eval "print ('Hello World');"

(while previously, it required an explicit trailing -batch argument
without which it would fail with a rather unintuitive
HeadlessException.)

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

This fixes './ImageJ-linux64 -eval ...' without an explicit trailing
'-batch' argument in headless settings.

Noticed while debugging Fiji bug 628.

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