Wednesday, September 9, 2009

GWT hosted mode on snow leopard

One of the first things I noticed after installing Snow Leopard was that GWT hosted mode no longer worked. You'll see the message "You must use a Java 1.5 runtime to use GWT Hosted Mode on Mac OS X." After spending about 10 minutes convincing myself that I was in fact using jdk1.5 for eclipse, ant, etc., and like, wasn't this working last week? I finally looked at the jdk symlinks in JavaVM.framework and figured out that 1.5 was just pointing to 1.6... interesting.

There was some discussion on the GWT group, along with a proposed fix of downloading someone's packaged leopard JDK and changing the symlinks. Not a great fix...

The Lombardi development team has come up with a great work-around.

I put together a jar with the modified BootStrapPlatform code (contains both .class and .java), or get just the src here.

Here are some step-by-step instructions for getting this working in Eclipse:

  1. add the gwt-dev-mac-snow jar to your Java Build path.

  2. in Java Build Path -> Order and Export, move the gwt-dev-mac-snow jar above the GWT SDK Library.

  3. go to Run->Run Configurations. In Web Applications->(your GWT project), click on Arguments, then add -d32 under VM arguments.


That's it! You should now be able to run GWT hosted mode on Snow Leopard.

3 comments:

Ben.S said...

I had seen the lombardi post and just didn't have enough programming background / Java / Eclipse knowledge to get the workaround going. But these instructions had me up and running in about 3 mins (and I'm beat after a long day). Really appreciate it - thanks.

dewphy said...

This post rocks! I was able to get hosted mode working in a minute,
Thanks!

Bruno Unna said...

Very useful, thank you very much.