Credits for this go to Johannes at Tudor.
Obviously I'm using ImageJ as the basis for my programm. I have been looking for a way to start ImageJ headless, having an instance without the WindowFrame, which starts up automatically when creating a new ImageJ-instance. I asked a few colleagues here at Tudor and we dived into the topic. In it's constructor ImageJ has a call for the show()-method, which instantly displays the ImageJ-window. show() has been deprecated for 2 Java-versions and so we thought, well let's override it locally. We empty the show()-method and on testing, nothing happened. Nothing like in "nothing showed up". We dived deeper. We couldn't use setVisible(boolean) the replacement of show() anymore, looked in the java-source only to find, that setVisible() does nothing more than using the old deprecated methods of show(). Nice one!
So we hacked a boolean-variable, which defines outside the class, whether or not the show should do something or not. Here is the code. Enjoy!
class StartIJheadless {
static boolean hide = true;
public static void main(String[] args) throws Exception {
ImageJ ij = new ImageJ() {
@Override
public void show() {
if (!hide)
super.show();
}
};
// ImageJ starts without GUI
hide= false;
ij.setVisible(true);
// it shows up 
}
}
I posted a request in the mailinglist of ImageJ to introduce a clean way to start IJ headless. This can't be the solution.