Porting a Java app that uses AWT and Swing for drawing movies to the server-side

The article Using Headless Mode in the Java SE Platform outlines the limitations imposed on such applications.

As a concrete example JFreeChart is a graphic program widely used in both desktop and servlet contexts. For the latter, any of several ChartUtils may be used to stream rendered content in a headless environment.

Alternatively, although deprecated, consider Java Web Start to deploy an existing Swing application, for example the JFreeChart demo seen here.

Addendum: This Oracle forum thread suggests that the Java Media Framework can indeed throw HeadlessException; a suggested workaround is to specify a particular system property value:

-Dawt.toolkit=sun.awt.HeadlessToolkit

This JFreeChart forum thread suggests Xvfb or vnc as alternatives when headless mode is not available.

Leave a Comment