5

I have a Java application that uses WebRenderer for a java headless browser. WebRenderer does not require xserver to run and I have confirmed this by uninstalling all x11 libs and xserver components.

However the problem is it throws an error: Gtk-WARNING **: cannot open display: in certain conditions. Upon research I found that it usually throws that error with systems that have openJDK installed. Also when the current java version is from Sun but openJDK is still installed. To fix it I would need to uninstall libatk-wrapper-java and libgtk2.0-0 (which also removes default-jre, cedtea-netx, libatk-wrapper-java-jni, libgtk2.0-bin, and openjdk-6-jre).

It also throws the same error in openSUSE (with Java from Sun). Would there be any way to fix this error without having to start up xserver or uninstalling a bunch of components that could be required for something else? Any help is appreciated.

KrispyDonuts
  • 1,262
  • 2
  • 18
  • 37

1 Answers1

1

Yes, use Xvfb.

In one terminal, you run Xvfb :1. In the other terminal, you run DISPLAY=:1 ./yourapp.

Some distros have a xvfb-run script that does the magic of launching Xvfb and your app on the same command.

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

Google for Xvfb for more information

pzanoni
  • 2,979
  • 2
  • 18
  • 18
  • However, running `Xvfb :1` starts the xserver, atleast thats what it seems like. This could be a backup solution, but for now I am seeing if there is a way without running xserver. – KrispyDonuts Aug 09 '12 at 14:36
  • Yes, but the goal of `Xvfb` is exactly to be used in this kind of situation. It won't require any graphics cards or do fancy stuff with your memory. It's way lighter than your normal "xserver". Either you fix the app or you give it a fake xserver with no screen. – pzanoni Aug 10 '12 at 01:42
  • Hmm I see. The only concern is when i do uninstall all the xserver libraries and libgtk it works fine. So in that case I dont really understand why it depends on xserver when libgtk is installed. – KrispyDonuts Aug 12 '12 at 14:08