Helpful Hint for Headless Unix Servers

While investigating Java charting solutions for use in JSP applications, I was introduced to the fearsome “headless server problem.” For the uninitiated, this is the problem where the Java AWT expects a GUI to be installed on the server so it can use the display driver to generate graphics. When you try to run something on a headless server that requires the AWT, you’ll get this error:

java.lang.InternalError: Can't connect to X11 window server using ':0.0'

The solution is simple when you’re using JDK 1.4, just add the following line before you start using any AWTclasses:


This simple line sets the AWT to run in headless mode, foregoing the system display driver and more importantly, making your code work. Nice of Sun to get around to this feature!

Managing Your Interrupt Rate as a Tech Lead E-book Cover

Take control of your calendar to get more done! The popular blog post series plus frequently asked questions all in one convenient PDF.

Download the Free E-book!

Managing Your Interrupt Rate as a Tech Lead is a free download that arrives in minutes.