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

前端 未结 1 897
庸人自扰
庸人自扰 2020-11-29 13:04

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

相关标签:
1条回答
  • 2020-11-29 13:40

    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.

    0 讨论(0)
提交回复
热议问题