我正在尝试通过 PuTTY 在 UNIX 服务器上运行 java 实用程序。这个 JAVA 实用程序启动一个 GUI。当我使用以下命令运行此实用程序时
./DAVTree.sh
我收到以下错误
Exception in thread "main" java.awt.HeadlessException:
No X11 DISPLAY variable was set, but this program performed an operation
which requires it.
at java.awt.GraphicsEnvironment.checkHeadless(Unknown Source)
at java.awt.Window.<init>(Unknown Source)
at java.awt.Frame.<init>(Unknown Source)
at java.awt.Frame.<init>(Unknown Source)
at javax.swing.JFrame.<init>(Unknown Source)
at com.sas.services.webdav.tools.DAVTree.<init>(DAVTree.java:319)
at com.sas.services.webdav.tools.DAVTree.main(DAVTree.java:944)
我在互联网上搜索了这个问题,它叫做X11 Forwarding
不知道那是什么,但我通过谷歌搜索遵循了建议,所以我用 PuTTY 和下创建了一个新会话
Connection > SSH > X11
检查是的Enable X11 Forwarding
现在,当我再次运行该实用程序时,错误\异常消息已更改,它现在说。
Exception in thread "main" 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$100(Unknown Source)
at sun.awt.X11GraphicsEnvironment$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at sun.awt.X11GraphicsEnvironment.<clinit>(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(Unknown Source)
at java.awt.Window.init(Unknown Source)
at java.awt.Window.<init>(Unknown Source)
at java.awt.Frame.<init>(Unknown Source)
at java.awt.Frame.<init>(Unknown Source)
at javax.swing.JFrame.<init>(Unknown Source)
at com.sas.services.webdav.tools.DAVTree.<init>(DAVTree.java:319)
at com.sas.services.webdav.tools.DAVTree.main(DAVTree.java:944)
现在它说没有设置 DISPLAY 变量。所以我试试这个
export DISPLAY=kcsclm92:7001
kcsclm:7001 将是我的服务器。在此之后,当我运行该实用程序时,它只给出相同的错误,但有以下区别
Exception in thread "main" java.lang.InternalError: Can't connect to X11 window
server using 'kcsclm92:7001' as the value of the DISPLAY variable.
在此之后我已经在盲人工作了,我没有什么可以尝试的了。请帮忙。
ps(对于那些了解 SAS 的人)我在 UNIX 服务器上部署了 SAS,我正在尝试运行 DAVTree 实用程序。