LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   How can I figure out the right value for the DISPLAY variable? (https://www.linuxquestions.org/questions/linux-general-1/how-can-i-figure-out-the-right-value-for-the-display-variable-917277/)

laredotornado 12-05-2011 01:52 PM

How can I figure out the right value for the DISPLAY variable?
 
Hi,

Here is my Linux version ...

Code:

Linux qa1234c 2.6.18-194.8.1.el5 #1 SMP Wed Jun 23 10:52:51 EDT 2010 x86_64 x86_64 x86_64 GNU/Linux
We are trying to run some google web toolkit integration tests, but the ones that rely on a display die with the error ...

Code:

Caused by: java.lang.Exception: java.lang.InternalError: Can't connect to X11 window server using 'localhost:10.0' as the value of the DISPLAY variable.
        at sun.awt.X11GraphicsEnvironment.initDisplay(Native Method)
        at sun.awt.X11GraphicsEnvironment.access$100(X11GraphicsEnvironment.java:52)
        at sun.awt.X11GraphicsEnvironment$1.run(X11GraphicsEnvironment.java:155)
        at java.security.AccessController.doPrivileged(Native Method)
        at sun.awt.X11GraphicsEnvironment.<clinit>(X11GraphicsEnvironment.java:131)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:169)
        at java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsEnvironment.java:68)
        at java.awt.image.BufferedImage.createGraphics(BufferedImage.java:1135)
        at com.google.gwt.resources.rg.ImageBundleBuilder.toPng(ImageBundleBuilder.java:538)
        at com.google.gwt.resources.rg.ImageResourceGenerator.reencodeToTempFile(ImageResourceGenerator.java:641)
        at com.google.gwt.resources.rg.ImageResourceGenerator.prepare(ImageResourceGenerator.java:567)
        at com.google.gwt.resources.rebind.context.AbstractClientBundleGenerator.initAndPrepare(AbstractClientBundleGenerator.java:1043)
        at com.google.gwt.resources.rebind.context.AbstractClientBundleGenerator.initAndPrepare(AbstractClientBundleGenerator.java:1069)
        at com.google.gwt.resources.rebind.context.AbstractClientBundleGenerator.generateIncrementally(AbstractClientBundleGenerator.java:412)
        at com.google.gwt.dev.javac.StandardGeneratorContext.runGeneratorIncrementally(StandardGeneratorContext.java:647)
        at com.google.gwt.dev.cfg.RuleGenerateWith.realize(RuleGenerateWith.java:41)
        at com.google.gwt.dev.shell.StandardRebindOracle$Rebinder.rebind(StandardRebindOracle.java:78)
        at com.google.gwt.dev.shell.StandardRebindOracle.rebind(StandardRebindOracle.java:268)
        at com.google.gwt.dev.shell.ShellModuleSpaceHost.rebind(ShellModuleSpaceHost.java:141)
        at com.google.gwt.dev.shell.ModuleSpace.rebind(ModuleSpace.java:585)
        at com.google.gwt.dev.shell.ModuleSpace.rebindAndCreate(ModuleSpace.java:455)
        at com.google.gwt.dev.shell.GWTBridgeImpl.create(GWTBridgeImpl.java:49)
        ... 43 more

I have tried setting my DISPLAY variable to ":0", ":10.0", and "localhost:10.0" but all failed. I have Xvfb installed. How can I figure out the proper values for the DISPLAY variable, or at least a strategy for attacking this error? Thanks - Dave

kbscores 12-05-2011 02:29 PM

try typing:
Code:

xhost +
This should allow - DISPLAY variable to work - I'd set DISPLAY=10.0

What xhost+ does is it grants access to everyone trying to access X server. If you want to limit it to localhost do a:

Code:

xhost + localhost

laredotornado 12-05-2011 02:43 PM

I tried this on a command line, but didn't get very far ...

Code:

ccqavob02c:/home/e18538 $ export DISPLAY=10.0
ccqavob02c:/home/e18538 $ xhost +
xhost:  unable to open display "10.0"

Further thoughts? - Dave

kubuntu-man 12-05-2011 03:16 PM

Most times, DISPLAY is
Code:

:0.0
or
Code:

localhost:0.0
As kbscores mentioned, you need to allow the connection via xhost.
There are different versions for the syntax. On my system, it is
Code:

xhost +
for ALL or
Code:

xhost +local:
for local clients.

For all of these versions, you need the x server to be up and running. I'm not sure if xvfb is sufficient.

EmaRsk 12-05-2011 04:19 PM

Why "10.0"? The current one is usually ":0.0". Maybe ":10.0"? It's still weird, though.
Maybe you should check the google web toolkit docs and try to figure this out.
Maybe you need to open a xnest or a xephyr on DISPLAY :10.0 .

laredotornado 12-06-2011 08:03 AM

I think I'm missing what "xhost" is supposed to do. My question is how do I figure out what the valid values of DISPLAY should be? I'm still getting these errors ...

Code:

[e18538@qa3398c ~]$ export DISPLAY="localhost:0.0"
[e18538@qa3398c ~]$ xhost +
xhost:  unable to open display "localhost:0.0"
[e18538@qa3398c ~]$ xhost +local
xhost:  unable to open display "localhost:0.0"

or if using DISPLAY=:0.0 ...

Code:

[e18538@qa3398c ~]$ export DISPLAY=":0.0"
[e18538@qa3398c ~]$ xhost +
xhost:  unable to open display ":0.0"
[e18538@qa3398c ~]$ xhost +local
xhost:  unable to open display ":0.0"

Thanks - Dave

kbscores 12-07-2011 09:34 AM

It most likely depends on where you want to display. For instance -- you have a server and a client --

On server use:
Code:

xhost +
On client:
Code:

export DISPLAY=ServerIP:0.0
./xprogram


The above code will run xprogram from client on display 1 of server.

So Same concept for doing this locally - Instead of there being two machines just do both steps on a single machine.
Code:

xhost +
export DISPLAY=localhost:0.0
./xprogram

Also - Lets say you were using a sunray - which typically has several Displays - echo $DISPLAY of terminal to diplay xprogram and instead of 0.0 you would want to use whatever echo $DISPLAY output.


All times are GMT -5. The time now is 08:52 PM.