Java application throws `Gtk-WARNING **: cannot open display:` even if xserver is not required

I have a Java application that uses WebRenderer for a browser without a java browser. WebRenderer does not require running xserver, and I confirmed this by removing all the x11 libs and xserver components.

However, the problem is that it throws an error: Gtk-WARNING **: cannot open display:in certain conditions. After researching, I found that it usually causes this error on systems where openJDK is installed. Also, when the current version of java is from Sun, but openJDK is still installed. To fix this, I need to remove libatk-wrapper-javaand libgtk2.0-0(which also removes the default-jre, cedtea-netx, libatk-wrapper-java-jni, libgtk2.0-binand openjdk-6-jre).

It also generates the same error in openSUSE (with Java from Sun). Will there be any way to fix this error without running xserver or removing a bunch of components that might be needed for something else? Any help is appreciated.

+5
source share
1 answer

Yes, use Xvfb.

In one terminal you run Xvfb :1. In another terminal you run DISPLAY=:1 ./yourapp.

Some distributions have a xvfb-runscript that does the magic of launching Xvfbyour application on the same command.

http://en.wikipedia.org/wiki/Xvfb

Google for Xvfbmore information

+1
source

All Articles