2015-03-25 116 views
0

我試圖通過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

enter image description here

現在,當我再次運行該實用程序時,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實用程序。

+2

你可以運行非Java應用程序嗎? (嘗試'xterm'這是一個簡單的終端模擬器,幾乎可以肯定安裝) – immibis 2015-03-25 06:23:43

回答

1

您需要在您的本地Windows機器上運行的X「服務器」。 (是的,這個術語很混亂)。嘗試http://mobaxterm.mobatek.net/

請注意,正確的DISPLAY設置將由Putty自動創建,因此請勿更改它(localhost:10聽起來正確)。

+0

已經做到了。我使用XMing並保持X11轉發已啓用... – Moon 2015-03-25 09:34:45

+0

有人應該真正構建一個具有集成XServer的Shell腳本工具。你繼續使用PuTTY和SSH安全殼多年,一天他們只是讓你失望 – Moon 2015-03-25 09:37:17

相關問題