我试图通过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.
此后我已经盲目工作了,我没有更多可尝试的了。请帮忙。
P.S。 (对于那些了解SAS的人)我在UNIX服务器上进行SAS部署,并且我正在尝试运行DAVTree实用程序。
答案 0 :(得分:1)
你需要一台X&#34;服务器&#34;在本地Windows计算机上运行。 (是的,术语令人困惑)。试试http://mobaxterm.mobatek.net/
请注意,Putty会自动创建正确的DISPLAY设置,因此请勿对其进行更改(localhost:10
听起来正确)。