我試圖通過PuTTY在UNIX服務器上運行java實用程序。這個JAVA實用程序啓動一個GUI。當我運行該工具使用以下命令X11嘗試使用GUI運行Java實用程序時出現錯誤的錯誤
./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
不知道那是什麼,但我也跟着通過google搜索建議,所以我創建了一個新的會話用膩子和下
Connection > SSH > X11
檢查是在Enable X11 Forwarding
現在,當我再次運行該實用程序時,error \ exception消息已經改變了它現在說的。
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實用程序。
你可以運行非Java應用程序嗎? (嘗試'xterm'這是一個簡單的終端模擬器,幾乎可以肯定安裝) – immibis 2015-03-25 06:23:43