tags:

views:

963

answers:

2

I can't start my GWT application in hosted mode (Debug as -> web application) using Eclipse. It throws me the exception mentioned in the title. Eclipse debug shows me the following code:

/*
 * 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;
 }
}

The exception being thrown is e1. I have not made any changes to the application, just created it and fired the debug.

What am I missing? I'm using Ubuntu 9.04 64 bits (don't know if this matters)

EDIT: stack trace

    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.
+1  A: 

Including the stacktrace, at least a few lines of it, can really help with these ones as it generally means your system is missing a system library of some form. I think the variable 'newname' actually will list the missing library if you're going through with a debugger.

I also run Ubuntu 9.04, though not 64 bit and when I hit an UnsatisfiedLink error, it was due to the wrong version of libstdc++. This fixed it for me:

sudo apt-get install libstdc++5
bikesandcode
Edited original question to include the stack trace. Tried installing libstdc++5, but no change... thanks for the help!
Rafael Almeida
+3  A: 

Solved the issue. After reading the stack trace more carefully (thanks Warren!), I ended up googling for different terms, and determined the cause to be the word width issue indeed.

The solution was to install a 32-bit JVM and tell Eclipse to use it instead of the 64-bit one. This is done by installing the new JVM, going to Window > Preferences > Java > Installed JREs in Eclipse and adding your new JVM (remember to point to the jre dir). Then I set it as the default one, and managed to run the example.

Rafael Almeida