Linux上 Can't connect to X11 window server using XX as the value of the DISPLAY 错误解决方法
在Linux上运行需要图形界面的程序时出现如下错误提示:
No protocol specified
Exception in thread "main" java.awt.AWTError: Can't connect to X11 window server using ':1.0' as the value of the DISPLAY variable.
at sun.awt.X11GraphicsEnvironment.initDisplay(Native Method)
at sun.awt.X11GraphicsEnvironment.access$200(X11GraphicsEnvironment.java:66)
at sun.awt.X11GraphicsEnvironment$1.run(X11GraphicsEnvironment.java:187)
at java.security.AccessController.doPrivileged(Native Method)
at sun.awt.X11GraphicsEnvironment.<clinit>(X11GraphicsEnvironment.java:146)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:260)
at java.awt.GraphicsEnvironment.createGE(GraphicsEnvironment.java:102)
at java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsEnvironment.java:81)
at sun.awt.X11.XToolkit.<clinit>(XToolkit.java:123)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:260)
at java.awt.Toolkit$2.run(Toolkit.java:860)
at java.awt.Toolkit$2.run(Toolkit.java:855)
at java.security.AccessController.doPrivileged(Native Method)
at java.awt.Toolkit.getDefaultToolkit(Toolkit.java:854)
at javax.swing.UIManager.getSystemLookAndFeelClassName(UIManager.java:611)
at hgdbmonitor.view.MonitorView.main(MonitorView.java:2147)
错误原因:
- Linux默认情况下是启动x11 windows server的,而且它是与windows的图形工具显示相关;
- 变量DISPLAY的值与程序界面显示在机器的哪个图形化终端有关,通过执行who命令和who am i 命令,可以知道当前图形化终端是第n个(如下是第2个),那么变量DISPLAY的值应该是IP:(n-1)或者:(n-1)(如下是:1.0),只有这样java图形程序的界面才能正常显示出来。
[root@localhost ~]# who
staff :0 2016-01-09 13:18(:0)
weblogic pts/1 2016-01-09 13:42(:0)
[root@localhost ~]# who am i
weblogic pts/1 2016-01-09 13:42(:0)
[root@localhost ~]# echo $DISPLAY
:0
解决办法:
笔者的错误是使用Centos桌面版界面,使用了staff用户登录,所以图形工具已经被staff用户所在的用户组所占用,因此weblogic用户组无法使用图形工具,只需把weblogic和staff两个用户变为一个组,或者使用weblogic用户登录Centos桌面版系统即可。
例如更改staff用户为weblogic用户组:
[root@localhost ~]# usermod -g weblogic staff
Linux上 Can't connect to X11 window server using XX as the value of the DISPLAY 错误解决方法的更多相关文章
- java.awt.AWTError: Can't connect to X11 window server using ':20' as the value of the DISPLAY variable
1.使用pio在Linux服务器上创建window文件时,需要使用到Linux的图形界面服务,出现以下问题需确认用户权限. 参考文献:https://zhidao.baidu.com/question ...
- Java在Linux下 不能处理图形的解决办法 Can't connect to X11 window server
java在图形处理时调用了本地的图形处理库.在利用Java作图形处理(比如:图片缩放,图片签名,生成报表)时,如果运行在windows上不会出问题.如果将程序移植到Linux/Unix上的时候有可能出 ...
- Linux启动应用(比如jmeter)报An error occurred: Can't connect to X11 window server using ':0.0' as the value of the DISPLAY variable.
Linux启动应用(比如jmeter)报An error occurred: Can't connect to X11 window server using ':0.0' as the value ...
- Linux 下centos7启动 Tomcat 抛出Can't connect to X11 window server 问题的解决方法
1 问题 今天启动 Tomcat 后,登录页验证码不见了.在 localhost.xxx.log 发现以下错误: org.apache.catalina.core.StandardWrapperVal ...
- Can't connect to X11 window server using 'localhost:10.0' as the value of the DISPLAY variable.
刚刚在一台Linux服务器上安装了jdk和Tomcat,然后部署了一个web项目,在项目中有个添加图片的功能,保存图片时报错 org.springframework.web.util.NestedSe ...
- 【java异常】org.springframework.web.util.NestedServletException: Handler processing failed;Can't connect to X11 window server using 'localhost:10.0' as the value of th
tomcat工程中创建二维码失败.抛出异常Can't connect to X11 window server using 'localhost:10.0' as the value of th 因为 ...
- oracle Can't connect to X11 window server using ':0.0' /Checking monitor: must be configured to display at least 256 colors解决方法
Can't connect to X11 window server using ':0.0' 解决方法 1. 以oracle 用户登陆X window 或者 2. root 身份执行 # xhost ...
- Can't connect to X11 window server using ':1.0' as the value of the DISPLAY variable.
安装oracle数据时需要用到图形界面安装,当我们用root用户登录后切换到oracle用户时运行./runInstaller提示报错: Can't connect to X11 window ser ...
- Can't connect to X11 window server using 'localhost:0.0' 的解决
Can't connect to X11 window server using 'localhost:0.0' 的解决 http://lufei-99999.blog.163.com/blog/st ...
随机推荐
- Manacher(马拉车)学习笔记
Manacher可以有效的在\(O(n)\)时间内解决一个字符串的回文子串的题目 目录 简介 讲解 推介 简单的练习 恐怖的练习QAQ 小结 简介 开头都说了,Manacher是目前解决回文子串的最有 ...
- DHT11温湿度传感器编程思路以及代码的实现(转载)
源自:https://blog.csdn.net/qq_34952376/article/details/81193938 在我们刚开始进入单片机的学习中,练习写传感器的时序是必不可少的,其实我比较推 ...
- SocketServer模块中的几种类
BaseServer:包括服务器的核心功能与混合类的一些功能. TCPServer:基本的网络同步TCP服务器. UDPServer:基本的网络同步UDP服务器. ForkingMixIn:实现了核心 ...
- go学习笔记-函数
函数 定义 格式 func function_name( [parameter list] ) [return_types] { 函数体 } 解析 func:函数由 func 开始声明 functio ...
- easyui 验证动态添加和删除问题
$.extend($.fn.validatebox.methods, { remove: function(jq, newposition){ return jq.each(function(){ $ ...
- 使用polarssl进行RSA加密解密
RSA算法的原理就不提了,网上有很多介绍的文章,因为项目中使用RSA加密,所以需要找一个RSA加密的算法,之前尝试过使用Crypto++库,无奈Crypto++其中使用了大量的模版,各种继承,看着头大 ...
- 2.Linux文件和目录
1. 目录和路径 linux下比较特殊的目录: . 代表此层目录 .. 代表上一层目录 - 代表前一个工作目录 ~ 代表『目前使用者身份』所在的home目录 ~account 代表 account 这 ...
- MySQL高可用之PXC安装部署(续)
Preface Yesterday I implemented a three-nodes PXC,but there were some errors when proceeding ...
- selenium 的安装使用
直接pip安装 pip install selenium 默认是火狐浏览器,需要安装下面网址的软件,解压后加入到环境变量中就可以了 https://github.com/mozilla/geckodr ...
- git部署详解
1.1 关于版本控制 1.1.1 本地版本控制 本地版本控制系统 许多人习惯用复制整个项目目录的方式来保存不同的版本,或许还会改名加上备份时间以示区别.这么做唯一的 好处就是简单,但是特别容易犯错.有 ...