I am working with some code that writes animated output to the desktop using AWT and Swing features. It draws using 2D graphics and renders text in fonts.
This code
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 ChartUtilities may be used to stream rendered content in a headless environment.
Alternatively, 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.