Question

I'm using a CIS that automatically run build and tests. The tests are working fine with Windows, but when run in rhel it throwed X11 Display variable not set.

I made sure X11 is installed and I can get back the xclock by using Xmanager. The intention is not to push the display to client but I used Xmanager to verify if X11 is installed.

When the display is not exported, the tests that uses graphics fails but when I set export DISPLAY=0.0, it threw java.lang.NoClassDefFoundError: sun/awt/X11GraphicsEnvironment

This source says the cNF exception is misleading.

Here is the scrap of that content:

Unfortunately, this error message is somewhat misleading. This message does not actually reflect a class loading problem. The error can be avoiding by setting the DISPLAY environment variable in the appropriate configuration file.

This means the display is not exported properly but the test does not report of missing X11 Display. What am I missing to do?

Suggestions are appreciated!

Was it helpful?

Solution

I am not sure from your description if you want to run the tests without X11. In that case, you could use headless mode to tell AWT that you don't want graphic output. That should allow your tests to run if they are not interactive.

I can't see how you can be able to run things like xclock, but not Java. Is there any intermediate step missing? Do you ssh into the host that should run the tests?

OTHER TIPS

export DISPLAY=0.0

This is a syntax error. You must use: export DISPLAY=:0.0

(Note the colon.)

Once that is right you'll need to ensure the user your tests run as has permissions to the X server. See xauth or for insecure but trivial testing xhost +.

Do you have an X display running?

One common way to get a display for automated tests is to use the Xvfb "fake" display server. Run Xvfb, then set DISPLAY pointing to it.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top