我正在使用自动运行构建和测试的 CIS。这些测试在 Windows 上运行良好,但在 rhel 中运行时它抛出 X11 Display variable not set。
我确定已安装 X11,并且可以使用 Xmanager 取回 xclock。目的不是将显示推送到客户端,而是我使用 Xmanager 来验证是否安装了 X11。
当显示未导出时,使用图形的测试失败但当我设置 export DISPLAY=0.0
时,它抛出 java.lang.NoClassDefFoundError: sun/awt/X11GraphicsEnvironment
This source说 cNF 异常具有误导性。
这是该内容的摘要:
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.
这意味着显示未正确导出,但测试未报告缺少 X11 显示。我想念什么?
欢迎提出建议!
最佳答案
导出显示=0.0
这是语法错误。你必须使用:
export DISPLAY=:0.0
(注意冒号。)
一旦正确,您将需要确保您的测试运行的用户具有对 X 服务器的权限。请参阅 xauth
或用于不安全但简单的测试 xhost +
。
关于linux - 接入X11显示器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4647212/