Linux X11 Libraries for Headless Mode

Java 1.4 and higher include support for “headless” mode, allowing many AWT operations to be used on machines that do not have a keyboard, mouse, or display. Launching a virtual machine in headless mode is simple: Just specify the java.awt.headless property on the command line:

java -Djava.awt.headless=true …

Headless mode is useful, for example, for rendering images from servlets running on a dedicated server. More details on headless mode can be found on Sun’s AWT Enhancements page.

Dedicated servers and virtual dedicated servers (or “virtual private servers”) are an increasingly affordable way to host java (and other) systems. While many dedicated server vendors offer Linux as an option, the default installations often lack X11 support. Fortunately, it is only necessary to install a subset of the X11 libraries to allow headless mode Java applications to function properly.

The listing below shows the minimal set of libraries needed to use JDK 1.4.2 under RedHat Linux 9.0, tested on a virtual dedicated server. The files can simply be uploaded from a full RedHat installation (on the same architecture) to /usr/X11R6/lib: