2009-08-29 34 views
0

我無法使用Eclipse在託管模式(調試爲 - > Web應用程序)中啓動我的GWT應用程序。它引發了我在標題中提到的例外。 Eclipse調試向我顯示以下代碼:啓動GWT託管模式時出現UnsatisfiedLinkError

/* 
* GOOGLE: Since we're bundling our own version of SWT, we need to be 
* able to tell SWT where its dynamic libraries live. Otherwise we'd 
* have to force our users to always specify a -Djava.library.path 
* on the command line. 
*/ 
String swtLibraryPath = System.getProperty ("swt.library.path"); 
try { 
    String newName = name + "-" + platform + "-" + version; //$NON-NLS-1$ //$NON-NLS-2$ 
    if (swtLibraryPath != null) 
     System.load(swtLibraryPath + System.mapLibraryName(newName)); 
    else 
     System.loadLibrary (newName); 
    return; 
} catch (UnsatisfiedLinkError e1) {  
    try { 
     String newName = name + "-" + platform; //$NON-NLS-1$ 
     if (swtLibraryPath != null) 
      System.load(swtLibraryPath + System.mapLibraryName(newName)); 
     else 
      System.loadLibrary (newName); 
     return; 
    } catch (UnsatisfiedLinkError e2) { 
     throw e1; 
    } 
} 

拋出的異常是e1。我還沒有對應用程序進行任何更改,只是創建它並啓動了調試。

我錯過了什麼?我使用的是Ubuntu 9.04的64位(不知道是不是這個事項)

編輯:堆棧跟蹤

 Exception in thread "main" java.lang.UnsatisfiedLinkError: /home/rafael/.eclipse/640022211/plugins/com.google.gwt.eclipse.sdkbundle.linux_1.7.0.v200907291526/gwt-linux-1.7.0/libswt-pi-gtk-3235.so: /home/rafael/.eclipse/640022211/plugins/com.google.gwt.eclipse.sdkbundle.linux_1.7.0.v200907291526/gwt-linux-1.7.0/libswt-pi-gtk-3235.so: wrong ELF class: ELFCLASS32 (Possible cause: architecture word width mismatch) 
     at java.lang.ClassLoader$NativeLibrary.load(Native Method) 
     at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1767) 
     at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1663) 
     at java.lang.Runtime.load0(Runtime.java:787) 
     at java.lang.System.load(System.java:1022) 
     at org.eclipse.swt.internal.Library.loadLibrary(Library.java:132) 
     at org.eclipse.swt.internal.gtk.OS.(OS.java:22) 
     at org.eclipse.swt.internal.Converter.wcsToMbcs(Converter.java:63) 
     at org.eclipse.swt.internal.Converter.wcsToMbcs(Converter.java:54) 
     at org.eclipse.swt.widgets.Display.(Display.java:126) 
     at com.google.gwt.dev.SwtHostedModeBase.(SwtHostedModeBase.java:82) 
    Could not find the main class: com.google.gwt.dev.HostedMode. Program will exit.

回答

5

解決了這個問題。在仔細閱讀堆棧跟蹤之後(感謝Warren!),我最終搜索了不同的術語,確定原因是字寬問題。

解決方案是安裝32位JVM並告訴Eclipse使用它而不是64位。這是通過安裝新的JVM完成的,在Eclipse中進入Window> Preferences> Java> Installed JRE並添加新的JVM(請記住指向jre目錄)。然後我將它設置爲默認值,並設法運行該示例。

1

包括堆棧跟蹤,它至少幾行,才能真正與這些的幫助因爲它通常意味着你的系統缺少某種形式的系統庫。我認爲變量'newname'實際上會列出丟失的庫,如果你正在使用調試器。

我也運行Ubuntu 9.04,但不是64位,當我遇到UnsatisfiedLink錯誤,這是由於libstdC++的錯誤版本。這對我來說是固定的:

sudo apt-get install libstdc++5 
+0

編輯原始問題以包含堆棧跟蹤。嘗試安裝libstdC++ 5,但沒有改變......感謝您的幫助! – 2009-08-29 02:15:09