I’ve recently been working with GWT (Google Web Toolkit) and ran into a small snag configuring it on my Ubuntu 8.10 setup. This will be a short HOW-TO for configuring GWT on Ubuntu or other linux distros. The three topics I’m going to talk about are:
- Getting the hosted browser working in linux
- Dealing with an external browser error when using Compile/Browse
- Adding GWT to the path.
Getting the Hosted Browser Working in Linux
When trying to run using the hosted browser (shell) I got the following exception:
** Unable to load Mozilla for hosted mode **
java.lang.UnsatisfiedLinkError: /home/hellz/projects/gwt-linux-1.5.3
/mozilla-1.7.12/libxpcom.so: libstdc++.so.5:
cannot open shared object file: No such file or directory
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1778)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1674)
at java.lang.Runtime.load0(Runtime.java:770)
at java.lang.System.load(System.java:1005)
at com.google.gwt.dev.shell.moz.MozillaInstall.load(MozillaInstall.java:190)
at com.google.gwt.dev.BootStrapPlatform.init(BootStrapPlatform.java:49)
at com.google.gwt.dev.GWTShell.main(GWTShell.java:354)
The key to troubleshooting the problem is in the second line, libstdc++.so.5 to be exact. It can’t find this C++ library. Turns out the hosted browser needs libstdc++5, but the version currently installed on my 8.10 system is libstdc++6. So you can either:
Open System->Administration->Synaptic Package Manager and install libstdc++5
or
At a console type: sudo apt-get install libstdc++5
Now you should be running in a hosted browser fine.
Error on Compile/Browse
The second issue you might run into is GWT not recognizing your external browser. You’ll know you have this problem after clicking on the Compile/Browse button.

You get an error that looks like:
[ERROR] Unable to find a default external web browser
[WARN] Try setting the environment variable GWT_EXTERNAL_BROWSER to
your web browser executable before launching the GWT shell

The problem is that GWT can’t find your default installed browser (which is most likely firefox). This is easy to fix:
- Open your .bashrc or .profile file, which is located in your home directory. So type gedit ~/.bashrc or nano ~/.bashrc or however else you want to open it. The reason I listed both files is because IMO the environment and pathing system of Ubuntu (and some other distros) is a spiderweb mess. I modified my .bashrc, but I’m not sure if that’s best practice.
- Add this line to the bottom of the file: export GWT_EXTERNAL_BROWSER=/usr/bin/firefox
- Logout and log back in for the changes to take affect.
Now the Compile/Browse button should bring up your external browser.
Adding GWT to the path
Add PATH=”$HOME/projects/gwt-linux-1.5.3:$PATH” to your .bashrc (or .profile) file. Of course you might have to modify the directory name to point where you have GWT installed. For this to take effect you’ll have to logout and log back in as well. You can double check your path to see if GWT has been added by typing echo $PATH. Once you have GWT added to your path you’ll be able to execute projectCreator and applicationCreator from anywhere.