
我試圖使用下面的命令在我的 ubuntu VM 中打開 Eclipse。
ubuntu@username-dyn-vm1-48493:~$ eclipse
Eclipse:
An error has occurred. See the log file
/home/ubuntu/.eclipse/org.eclipse.platform_3.8_155965261/configuration/1381367113197.log.
所以當我轉到那個特定的日誌檔案時,這就是我在日誌中看到的內容 -
ubuntu@username-dyn-vm1-48493:~$ more /home/ubuntu/.eclipse/org.eclipse.platform_3.8_155965261/configuration/1381367113197.log
!SESSION 2013-10-10 01:05:13.088 -----------------------------------------------
eclipse.buildId=debbuild
java.version=1.7.0_25
java.vendor=Oracle Corporation
BootLoader constants: OS=linux, ARCH=x86_64, WS=gtk, NL=en_US
Command-line arguments: -os linux -ws gtk -arch x86_64
!ENTRY org.eclipse.osgi 4 0 2013-10-10 01:05:17.555
!MESSAGE Application error
!STACK 1
org.eclipse.swt.SWTError: No more handles [gtk_init_check() failed]
at org.eclipse.swt.SWT.error(SWT.java:4387)
at org.eclipse.swt.widgets.Display.createDisplay(Display.java:914)
at org.eclipse.swt.widgets.Display.create(Display.java:900)
at org.eclipse.swt.graphics.Device.<init>(Device.java:156)
at org.eclipse.swt.widgets.Display.<init>(Display.java:498)
at org.eclipse.swt.widgets.Display.<init>(Display.java:489)
at org.eclipse.ui.internal.Workbench.createDisplay(Workbench.java:716)
at org.eclipse.ui.PlatformUI.createDisplay(PlatformUI.java:161)
at org.eclipse.ui.internal.ide.application.IDEApplication.createDisplay(IDEApplication.java:154)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:96)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:353)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:180)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:629)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:584)
at org.eclipse.equinox.launcher.Main.run(Main.java:1438)
at org.eclipse.equinox.launcher.Main.main(Main.java:1414)
有誰知道發生了什麼問題?或者我應該做什麼來解決這個問題?謝謝..
更新:-
版本詳細資訊如下 -
ubuntu@username-dyn-vm1-48493:~$ dpkg -l libgtk[0-9]* | grep ^i
ii libgtk2.0-0:amd64 2.24.17-0ubuntu2 amd64 GTK+ graphical user interface library
ii libgtk2.0-bin 2.24.17-0ubuntu2 amd64 programs for the GTK+ graphical user interface library
ii libgtk2.0-common 2.24.17-0ubuntu2 all common files for the GTK+ graphical user interface library
答案1
如果您嘗試透過 ssh 啟動 Eclipse 而不轉發 X 訪問,也會出現此錯誤。即,您忘記運行ssh -X user@host
或忘記包含ForwardX11 yes
在~/.ssh/config
伺服器條目中。
我為任何可能從 Google 搜尋中偶然發現這個問題的人添加這個答案,即使從技術上講,OP 正在詢問 VM 案例。
答案2
我認為這是gtk的問題。檢查安裝的是什麼版本。
dpkg -l libgtk[0-9]* | grep ^i
如果未安裝或版本不正確,則執行 asudo apt-get install gtk
或sudo apt-get update
.
編輯
問題在於 SSH 使用 SSH 遠端存取 Linux VM,並且沒有在 Windows 上設定 X-Server,也沒有啟用 X11 轉送。解決這個問題後,OP 運行 Eclipse 應該不會有任何問題。
答案3
此外,這也可能是由於應用程式沒有正確的授權來顯示到遠端造成的X server
。當您以一個使用者登入 ssh 會話並以另一個使用者身分執行命令來啟動 GUI 應用程式時,通常會發生這種情況。例如,當您登入遠端伺服器並執行sudo
命令時。若要解決此問題,您需要取得登入使用者的 magic cookie,並為執行命令的使用者匯入 cookie。
當使用者登入有權顯示的伺服器時X
,執行:
xauth extract cookie_file $DISPLAY
然後當使用者嘗試執行 gui:
xauth
mergecookie_file
一旦 cookie 被匯入到使用者的 .Xauthority
文件後,您應該能夠執行 GUI。
答案4
如果您在具有 Gnome 的 Linux 上運行:
使用 Xorg 會話啟動 Gnome:
在 GDM(歡迎/登入管理員)中點擊您的用戶名後,點擊您的用戶名,然後在輸入密碼之前,點擊小齒輪並選擇 Gnome with Xorg,然後輸入您的密碼