访问 X11 显示
我正在使用自动运行构建和测试的 CIS。测试在 Windows 上运行良好,但在 rhel 中运行时,它抛出 X11 Display 变量未设置。
我确保 X11 已安装,并且我可以使用 Xmanager 取回 xclock。目的不是将显示推送到客户端,而是使用 Xmanager 来验证是否安装了 X11。
当未导出显示时,使用图形的测试失败,但当我设置导出DISPLAY=0.0
时,它抛出java.lang.NoClassDefFoundError:sun/awt/X11GraphicsEnvironment
< a href="http://download.oracle.com/otn_hosted_doc/jdeveloper/904preview/uixhelp/uixdevguide/xserver.html" rel="nofollow">此来源表示 cNF 异常具有误导性。
以下是该内容的片段:
不幸的是,这个错误消息有些误导。该消息实际上并不反映类加载问题。通过在适当的配置文件中设置 DISPLAY 环境变量可以避免该错误。
这意味着显示器未正确导出,但测试未报告丢失的 X11 Display。我缺少做什么?
感谢建议!
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!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
export DISPLAY=0.0
这是一个语法错误。您必须使用:
export DISPLAY=:0.0
(注意冒号。)
一旦正确,您需要确保运行测试的用户拥有 X 服务器的权限。请参阅 xauth 或进行不安全但琐碎的测试 xhost + 。
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 testingxhost +
.您是否正在运行 X 显示器?
获取用于自动化测试的显示的一种常见方法是使用 Xvfb“假”显示服务器。运行 Xvfb,然后设置 DISPLAY 指向它。
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.
从您的描述中我不确定您是否想在没有 X11 的情况下运行测试。在这种情况下,您可以使用 无头模式 告诉 AWT 您不想要图形输出。如果测试不是交互式的,这应该允许您的测试运行。
我不明白你如何能够运行像 xclock 这样的东西,但不能运行 Java。是否缺少任何中间步骤?您是否通过 ssh 连接到应运行测试的主机?
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?