Here are the steps required to download and run the source code for the samples that we have developed in this book:
1. Download the ZIP file that contains the source code for our samples from the website for this book (http://www.packtpub.com/support). Unzip them to your hard disk. There should be two directories—
Samples
andWidgets
—created when you unzip the file. These two directories contain the source code for the applications that we have developed in this book.2. Start Eclipse 3.2. Create a new class path variable named
GWT_HOME
. Go to Window | Preferences | Java | Build Path | Classpath Variables. Add a new variable entry namedGWT_HOME
and set it to the directory where you have unzipped the GWT distribution, for example:C:\gwt-windows-1.3.1
. This ensures that the GWT JAR files will be available to the samples project.3. Import the two projects into your Eclipse workspace, one at a time. You can import an existing project into Eclipse by going to File | Import | Existing projects into Workspace and then selecting the root directory for the project. The
Widgets
project is used for creating the two widgets that are packaged up in a JAR file and used by theSamples
project. It therefore does not define an entry point. All you need to do is run/debug theSamples
project.4. You can run the
Samples
project from inside Eclipse. Go to Run | Run … and selectSamples
. This will start up the familiar GWT shell and launch the hosted browser with theSamples
application.5. You can debug the
Samples
project from inside eclipse. Go to Debug | Debug … and select Samples.6. If you have Apache Ant installed, you can use the
Samples.ant.xml
file to build the application and create a WAR file that can be used for deployment to a servlet container such as Tomcat.7. You can also run the
Samples-compile.cmd
to compile the application andSamples-shell.cmd
to run the application from a console on Windows.