Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Fake X11 display?

Tags:

java

linux

x11

awt

I have a Java program using AWT which I would like to run on a headless system. The display for the program does nothing other than display stats. When the program finishes, it exits. There is no user interaction on the display. The program creates an output file which I use in my build system.

Is there a way to get the Java program to run without an X11 display configured? Can I force Java to run the program without trying to display anything? I do not have access to the source code (it is just .jar file), so I can't make modifications to the source.

Any thoughts on how I could get this to work?

like image 829
ashchristopher Avatar asked Jan 30 '09 04:01

ashchristopher


2 Answers

The underlying question here is how to run Java applications without an X server; providing a "fake" X server is only one option. In Java 1.4 and up, you can do the following:

java -Djava.awt.headless=true

This allows applications which use AWT to run on headless systems even without an X server.

like image 142
Charles Duffy Avatar answered Oct 10 '22 07:10

Charles Duffy


Xvfb can do what you ask for. I've not used it myself, but here is a link to wikipedia: http://en.wikipedia.org/wiki/Xvfb

like image 27
Peter B. Bock Avatar answered Oct 10 '22 07:10

Peter B. Bock