Use swing thread for error message dialog display

I never thought that calling a message dialog could ever cause problems, but the error message dialog got caught in a weird deadlock in showMessageDialog() today. 

Not sure if this is because it was called from a different thread than the Swing GUI thread, but according to the specs. this is obligatory and it's also the only thing I can think of.

It now also shows only if a graphics environment is available (e.g. Jenkins probably doesn't have one)