Java无法使用'localhost:10.0'作为DISPLAY变量的值连接到X11窗口服务器

Elteroooo:

我有一个脚本使用Java连接到本地主机的端口10.0中显示X11

但我总是得到这个错误

java.lang.InternalError: Can't connect to X11 window server using 'localhost:10.0' as the value of the DISPLAY variable.
    at sun.awt.X11GraphicsEnvironment.initDisplay(Native Method)
    at sun.awt.X11GraphicsEnvironment.access$200(X11GraphicsEnvironment.java:62)
    at sun.awt.X11GraphicsEnvironment$1.run(X11GraphicsEnvironment.java:178)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.awt.X11GraphicsEnvironment.<clinit>(X11GraphicsEnvironment.java:142)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:186)
    at java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsEnvironment.java:82)
    at sun.awt.X11.XToolkit.<clinit>(XToolkit.java:112)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:186)
    at java.awt.Toolkit$2.run(Toolkit.java:849)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.awt.Toolkit.getDefaultToolkit(Toolkit.java:841)
    at ij.io.Opener.openJpegOrGif(Opener.java:367)
    at ij.io.Opener.openImage(Opener.java:220)
    at ij.io.Opener.openImage(Opener.java:249)
    at ij.io.Opener.open(Opener.java:116)
    at ij.IJ.open(IJ.java:1112)
    at ij.macro.Functions.open(Functions.java:2006)
    at ij.macro.Functions.doFunction(Functions.java:129)
    at ij.macro.Interpreter.doStatement(Interpreter.java:205)
    at ij.macro.Interpreter.doBlock(Interpreter.java:515)
    at ij.macro.Interpreter.runUserFunction(Interpreter.java:278)
    at ij.macro.Interpreter.getFactor(Interpreter.java:1200)
    at ij.macro.Interpreter.getTerm(Interpreter.java:1162)
    at ij.macro.Interpreter.getExpression(Interpreter.java:1145)
    at ij.macro.Interpreter.getBooleanExpression(Interpreter.java:881)
    at ij.macro.Interpreter.getLogicalExpression(Interpreter.java:857)
    at ij.macro.Interpreter.getBoolean(Interpreter.java:850)
    at ij.macro.Interpreter.doIf(Interpreter.java:829)
    at ij.macro.Interpreter.doStatement(Interpreter.java:217)
    at ij.macro.Interpreter.doBlock(Interpreter.java:515)
    at ij.macro.Interpreter.doStatement(Interpreter.java:241)
    at ij.macro.Interpreter.doIf(Interpreter.java:831)
    at ij.macro.Interpreter.doStatement(Interpreter.java:217)
    at ij.macro.Interpreter.doStatements(Interpreter.java:195)
    at ij.macro.Interpreter.run(Interpreter.java:99)
    at ij.macro.Interpreter.run(Interpreter.java:65)
    at ij.macro.Interpreter.run(Interpreter.java:75)
    at ij.plugin.Macro_Runner.runMacro(Macro_Runner.java:127)
    at ij.plugin.Macro_Runner.runMacroFile(Macro_Runner.java:112)
    at ij.IJ.runMacroFile(IJ.java:103)
    at ij.ImageJ.main(ImageJ.java:517)

我已经尽一切努力解决这个问题,例如:

export DISPLAY=:10.0
export DISPLAY=localhost:10.0

我也尝试了端口0.0,但总是得到相同的错误

尝试xhost之后

xhost +local:all
xhost:  unable to open display ""
xhost:  unable to open display ":10.0"

我该如何解决这个问题,我认为X Server没有运行,所以我尝试了startx它说在该端口运行

我的系统是Ubuntu服务器版本10.04

Maryam Saeidi:

这个命令帮助我解决了这个问题:

export DISPLAY=:0

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

无法连接到MySQL localhost服务器Win32Exception

无法使用HeidiSQL连接到Vagrant:“无法连接到'localhost'上的MySQL服务器”

java.net.ConnectException:无法通过Spring Bot中的Selenium Java使用ChromeDriver Chrome连接到localhost / 0:0:0:0:0:0:1:1731

无法在Windows 10上访问localhost python服务器

SignalR:无法使用完整的IP地址连接到http:// localhost:8080自托管服务器

zookeeper无法打开localhost / 0:0:0:0:0:0:0:0:1:2181的套接字

ElasticHQ:无法连接到服务器!收到的状态码:0

MongoError:首次连接时无法连接到服务器[localhost:27017]

无法连接到运行IIS的服务器上的Localhost

Visual Studio 2005:无法连接到Visual Studio的localhost Web服务器

无法连接到redis:// localhost:6379/0:错误99连接到localhost:6379。无法分配请求的地址

UnhandledPromiseRejectionWarning:MongoNetworkError:首次连接[MongoNetworkError]时无法连接到服务器[localhost:27017]

使用Docker的MongoDB在“首次连接时无法连接到服务器[localhost:27017]”

无法从Kubernetes Engine连接到CloudSQL(无法连接到“ localhost”上的MySQL服务器)

无法使用PHP连接到localhost MySQL服务器

拒绝连接:使用gRPC的localhost / 0:0:0:0:0:0:0:1:9000

无法连接到服务器:连接被拒绝(0x0000274D / 10061)-远程服务器上的PostgreSQL

如何修复'无法在'localhost:3306'上连接到MySQL服务器'错误

无法将OSQuery从窗口服务器连接到Kolide Fleet

服务器将无法连接到网络;找不到设备eth0

Windows 10无法连接到PPTP VPN服务器

当我尝试“ ssh localhost”或“ source〜/ .bashrc”时,“无法连接到X服务器”

无法在Windows 10上使用MAMP连接到'localhost'(10061)(2003)上的MySQL服务器错误phpmyadmin

尽管有ioff()和matplotlib.use('Agg'),但Pyplot“无法连接到X服务器localhost:10.0”

无法连接到本地主机(0)上的MySQL服务器。错误编号2003

线程“main”中的异常 java.awt.AWTError: 无法使用 ':0.0' 作为 DISPLAY 变量的值连接到 X11 窗口服务器

从php执行jar文件时无法连接到X11服务器

Javamail 无法连接到 postfix localhost 服务器

django postgres 无法连接到服务器:连接被拒绝服务器是否在主机“localhost”(127.0.0.1)上运行