Host Mode

What's the GwtAjax-shell script for? This script is another one of the GWT's command-line tools. The script will launch a special browser that the GWT provides, as well as a window that will display a log with debugging information for your application. This special browser is designed to debug and display your application as Java objects loaded into a Java Virtual Machine (JVM), before the GWT has generated JavaScript from it.

Along with the coding of your application in an IDE, the GWT calls this development stage host mode. Figure 5 shows a GWT application running in host mode.

Here is what the GwtAjax-shell script or XXX-shell looks like:

#!/bin/sh
APPDIR='dirname $0';
java -XstartOnFirstThread -cp "$APPDIR/src:$APPDIR/bin:/Users/bruceperry/1gwt/gwt-mac-
1.2.11/gwt-user.jar:/Users/bruceperry/1gwt/gwt-mac-1.2.11/gwt-dev-mac.jar"
com.google.gwt.dev.GWTShell -out "$APPDIR/www" "$@"
com.parkerriver.gwt.intro.GwtAjax/GwtAjax.html;

Notice the Java classpath, the quoted string following the -cp option in the shell script. It includes the /src and /bin directories in the top level of the application, as well as the gwt-user.jar and gwt-dev-mac.jar (or, for instance, gwt-dev-linux.jar) libraries.

The code that you use or depend on to create your application, before launching host mode, must be included on the classpath. For instance, if you are using various JAR files, such as jdom.jar, junit.jar, or log4j.jar (representing the JDOM XML-handling library, the JUnit unit-testing framework, ...

Get Google Web Toolkit for Ajax now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.