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!
Disclaimer: Any viewpoints and opinions expressed in this article are those of Nicholas C. Zakas and do not, in any way, reflect those of my employer, my colleagues, Wrox Publishing, O'Reilly Publishing, or anyone else. I speak only for myself, not for them.
Both comments and pings are currently closed.