can't open display
来源:互联网 发布:淘宝网充值中心在哪 编辑:程序博客网 时间:2024/04/30 02:15
在Linux/Unix类操作系统上, DISPLAY用来设置将图形显示到何处. 直接登陆图形界面或者登陆命令行界面后使用startx启动图形, DISPLAY环境变量将自动设置为:0:0, 此时可以打开终端, 输出图形程序的名称(比如xclock)来启动程序, 图形将显示在本地窗口上, 在终端上输入printenv查看当前环境变量, 输出结果中有如下内容:
DISPLAY=:0.0
使用xdpyinfo可以查看到当前显示的更详细的信息.
DISPLAY 环境变量格式如下host:NumA.NumB, host指Xserver所在的主机主机名或者ip地址, 图形将显示在这一机器上, 可以是启动了图形界面的Linux/Unix机器, 也可以是安装了Exceed, X-Deep/32等Windows平台运行的Xserver的Windows机器. 如果Host为空, 则表示Xserver运行于本机, 并且图形程序(Xclient)使用unix socket方式连接到Xserver, 而不是TCP方式. 使用TCP方式连接时, NumA为连接的端口减去6000的值, 如果NumA为0, 则表示连接到6000端口; 使用unix socket方式连接时则表示连接的unix socket的路径, 如果为0, 则表示连接到/tmp/.X11-unix/X0 . NumB则几乎总是0.
如果使用su username或者su - username切换到别的用户, 并且使用命令
export DISPLAY=:0.0
##(这句话可以写进.bashrc,就可以省去每次设计的麻烦)我注
设置DISPLAY环境变量, 运行图形程序(如xclock)时会收到如下错误:
Xlib: connection to ":0.0" refused by server
Xlib: No protocol specifiedr
Error: Can't open display: :0.0
这是因为Xserver默认情况下不允许别的用户的图形程序的图形显示在当前屏幕上. 如果需要别的用户的图形显示在当前屏幕上, 则应以当前登陆的用户, 也就是切换身份前的用户执行如下命令
xhost +
例:su - root
xhost +
su - oracle
root与oracle用户的DISPLAY都为:0.0
- can't open display
- CAN'T OPEN DISPLAY
- su 用户后,can't open display
- 连接时出现:Can't open display: localhost:10.0
- linux下 安装 oracle11g 错误 Can't open display: xxx
- 【解决】xterm Xt error: Can't open display: xterm: DISPLAY is not set
- 转载 本机运行x程序出现:Can't open display 原因及其解决方法
- 转载 本机运行x程序出现:Can't open display 原因及其解决方法
- 本机运行x程序出现:Can't open display 原因及其解决方法
- 解决xterm显示远程窗口出现“Can't open display: localhost:11.0”的问题
- 转载 本机运行x程序出现:Can't open display 原因及其解决方法
- 通过xstart启动gnome桌面 连接时报错:Can't open display: localhost:10.0
- 转载 本机运行x程序出现:Can't open display 原因及其解决方法
- can't open the link
- rman: can't open target
- rman: can't open target
- Xlib: connection to "0.0" refused by server Xlib: No protocol specified Error:Can't open display:0.0
- centos 6 下安装oracle 报错 Error: Can't open display 和 Exception in thread "main" java.lang.NoClassDefFou
- linux command: cp, mv, rm
- HTTP协议 (四) 缓存
- mysql ERROR 1045 (28000): Access denied for user 'zyl'@'localhost' (using password: YES)
- javascript学习笔记(三)
- Android事件分发机制完全解析,带你从源码的角度彻底理解(上)
- can't open display
- MediaRecorder start failed -19 java.lang.RuntimeException: start failed
- 黑马程序员--第二十三天:网络编程第一天
- [日志]静心
- ERROR 2003 (HY000): Can't connect to MySQL server
- 设计模式之原型模式(clone)
- [bzoj1503][NOI2004]郁闷的出纳员
- Android之AsyncTask(一)
- 用带参数的宏定义,通过海伦公式求三角形的面积