Auto detect headless

I think there was some way to do this using SciJava...