** Unable to load Mozilla for hosted mode ** (GWT & Ubuntu 8.10 Linux)
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.
[...] /home/nick » Blog Archive » ** Unable to load Mozilla for hosted … [...]
Thanks!!!
You saved my day!
ditto!
Thanks a lot… It was really a “Columbus egg” solution. Thumbs up !
Tx man! Saved my day also!!!
[]s
Worked great for me too
man
u r great
Hi
Thanks for that nice solution.
However I am working on Ubuntu 8.04 and I ran into this problem when the Hosted browser started up:
The server is running at http://localhost:8080/
#
# An unexpected error has been detected by Java Runtime Environment:
#
# SIGSEGV (0xb) at pc=0x0625665c, pid=7870, tid=2421586832
#
# Java VM: Java HotSpot(TM) Server VM (10.0-b23 mixed mode linux-x86)
# Problematic frame:
# V [libjvm.so+0x25665c]
#
# An error report file with more information is saved as:
# /home/gavin/eclipse_projects/SampleGWT/war/hs_err_pid7870.log
#
# If you would like to submit a bug report, please visit:
# http://java.sun.com/webapps/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#
Any one else faced this problem?
Please point me to a place where I can get help.
I did search the sun java forums …but no help….No help from the bugreport people either.
Thanks in advance for any pointers.
Gavin
Thank you. This really saved a lot of useless troubleshooting – I would have been tweaking perms. on firefox directories all night.
Great Man.
I am Using Linux Enterprise Desktop 11.
I worked for me.
thnx dude
was really helpful n quick
Thanks for this post- it was very helpful.
You’re probably better off putting GWT_EXTERNAL_BROWSER in your .profile, which gets executed at login. That way, no matter how you launch Eclipse, it will be available.
If you only add it to your .bashrc, you’ll have to launch Eclipse from inside the terminal.
Thanks buddy.Simple ,short and efficient solution.
Thanks, Merci!!
thanks! Very helpful
For Gavin (and other Ubuntu users) – you may need to edit this file:
~/opt/java/libs/gwt-linux-1.7.1/mozilla-1.7.12/gwt-dl-loadorder.conf
Here is the contents of mine:
libnspr4.so
libplc4.so
libxpcom.so
libmozz.so
libmozjs.so
libgkgfx.so
components/libtypeaheadfind.so
components/libembedcomponents.so
components/libpref.so
components/libsystem-pref.so
components/libnecko.so
components/libcaps.so
components/libjsd.so
libgtkembedmoz.so
libsoftokn3.so
libnss3.so
libplds4.so
Thanks
You are so right.
I fixed this issue in 5 mins after I checked this article.
Thanks Nick. The article helped me a lot.
Running a GWT application in ubuntu. but i am facing problem in loading the app in hosted mode. Can any one tell me the problem
[ERROR] 503 – GET /ehrgwt.html (127.0.0.1) 1318 bytes
Thx in advance
KAlpana