Since I just hit my head against the wall for a couple of hours, I'll see if I can spare others the trouble. (Cudos to Janne for hints on this one.)


You want to generate dynamic graphics in a command line app or a servlet in unix, never actually displaying anything. You get a "connection to X11 server refused" error, because an X server is not running or you don't have permissions to access it.



start Java with -Djava.awt.headless=true. See

Be also prepared for HeadlessExceptions, which get thrown if you do anything that would actually require a windowing system. --JanneJalkanen

Older JDK's:

See if you can install xvfb, a virtual X server, made for nasty software just like AWT-based Java. Or, see if you can use PJA,


Text by ebu.

JanneJalkanen: This reminds me, are there any good alternatives to AWT?

Wiki Category Java

Add new attachment

Only authorized users are allowed to upload new attachments.
« This page (revision-5) was last changed on 14-Apr-2004 12:45 by SebastianPetzelberger