Fake X11 display?

15,070

Solution 1

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.

Solution 2

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

Solution 3

You can use a vncserver.

vncserver :1001
export DISPLAY=localhost:1001
java..

The added advantages is that you can actually view the gui using vncserver 'just in case'

Solution 4

Could also run Xvnc in a low resolution and color depth.

Solution 5

As mentioned by Charles Duffy the traditional method is to tell Java to go headless.

Note that you can always mount the jar in Eclipse and use jad+jadclipse to see what it actually does, and perhaps even override a class if you need to by putting another class-file in "front" of it in the classpath.

A facility that might be relevant if the program uses Java2D is that newer Java versions use optimizations in the X11 server to render faster. This alone might be a reason to devote an X11 server attached to a high performance graphics card to your graphics processing.

Share:
15,070
ashchristopher
Author by

ashchristopher

Updated on September 09, 2022

Comments

  • ashchristopher
    ashchristopher over 1 year

    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?