GWT101Technical RequirementsOperating System Options
Java Development Kit (JDK)
BrowserAt least one of the following browsers. Browsers for WindowsBrowsers for Mac OS X
GWT 2.x SDK
Eclipse for Java EE Developers
Class FilesSetup InstructionsThe current materials have been set up for GWT 2.1. For the most part, they will work in GWT 2.0 as well, with a few exceptions - see the end of this page for more information. 1. Unzip Webucator Class Files to a directory of your choice. You will now see a ClassFiles folder with a number of folders.
2. Unzip the GWT Installation Zip in an appropriate directory. Target (for example): C:\tools\gwt-windows-2.1.1
If you have the Eclipse plugin, the above is not necessary - you can find
the GWT directory in a location like:
C:\eclipse\plugins\com.google.gwt.eclipse.sdkbundle.2.1.1_2.1.1.v201012170127\gwt-2.1.1 We strongly recommend using Eclipse, or another IDE with a GWT plugin that is
compatible with the Eclipse/GWT project structure.
3. Non-Eclipse only: Once created, set GWT_HOME to the GWT installation directory. For example:
SET GWT_HOME=C:\tools\gwt-windows-2.1.1
4. Non-Eclipse only: If you haven't already, add the Ant bin directory to your path. Like with Java, the recommended approach is to create an ANT_HOME variable to the
Ant directory, and then add %ANT_HOME%\bin to your path.
Also add the GWT_HOME to your path.
SET PATH=%GWT_HOME%;%ANT_HOME%\bin;%PATH%
See: ClassFiles\setup.cmd - this can be used to set the variables
each time you open a command prompt window if you do not wish to set
the environment variables in a more permanent fashion. You will probably need to
edit the paths to match your system.
5. Non-Eclipse only: Open a command prompt window and change directory to ClassFiles. 6. Non-Eclipse only: Run setup.cmd. This may duplicate some environment variables, but also adds ClassFiles to your PATH for convenience later if you use our command
scripts. Note that these variables will only hold for the current command prompt
session. You must repeat this each time you open a command prompt window. If you
wish, you can edit this to only set those variables that you do not have
as permanent environment variables.
7. Non-Eclipse only: Change directory to SetupTest, and create a test project: webAppCreator -out firstapp com.webucator.gwt.firstapp.FirstApp
8. Non-Eclipse only: Change to the newly created firstapp directory and review the files that were created.
9. Non-Eclipse only: Run "ant hosted" to see the resulting application. The first time you run GWT development mode in a browser it will want to
download a plugin; you must do that in order to proceed.
10. Non-Eclipse only: The above worked because GWT knows its location, and hard-codes it into the build.xml file it creates. For the demos, exercises, and solutions
we have supplied, a hard-coded location might not match your setup.
So, we have modified the build.xml files to use a properties file that
defines the a GWT_HOME property. Modfy this file to match your setup.
11. If you are using Eclipse: Open Eclipse. When it asks for a workspace location, browse to ClassFiles\Workspace. (If that does not exist, just create it - it
should initially be empty.)
Set up an Eclipse GWT_HOME Build Path variable:
Window -> Preferences -> Java -> Build Path -> Classpath Variables -> New ...
Name: GWT_HOME
Path: (choose as a Folder the location where GWT is installed)
Should be something like:
C:\eclipse\plugins\com.google.gwt.eclipse.sdkbundle.2.1.1_2.1.1.v201012170127\gwt-2.1.1
This Eclipse variable is referred to in all the Eclipse project classpaths
You can then import the complete set of projects into Eclipse with:
File --> Import --> General: Existing projects into workspace -->
Next --> (paste full path to, and including, ClassFiles, but not Workspace),
then press Browse --> (your projects should appear and be checked after you OK
the dialog) --> Finish
Most of the projects should show up without a red flag. There may be a few exercises
where the incomplete source code will cause errors to show (like undeclared variables
that are referenced later - we have tried to minimize these, but in some cases it
reduces the value of the exercise if we put the declaration in).
A lot of red flags usually means that GWT_HOME is not set correctly, or that the
issue mentioned below regarding gwt-dev.jar is occurring.
You can test-run an project Xyz by opening it, right-clicking on the Xyz.launch
file near the end of the list, and choosing Run As... Xyz
The first time you run GWT development mode in a browser it will want to
download a plugin; you must do that in order to proceed.
12. Prior to GWT 2.0, the development classes were in a file named gwt-dev-windows.jar. In GWT 2.0, that file became gwt-dev.jar.
Command line execution: the build.xml files that you would use from the
command line take care of this by referencing gwt-dev*.jar.
GWT 2+ with Eclipse: the quick and dirty solution is to make a copy of gwt-dev.jar,
and rename the copy to gwt-dev-windows.jar.
OR, files containing references to that file must be changed:
- ignore any files with a .cmd extension (these are for GWT 1.5 from a command prompt)
- .classpath and .launch files should be changed if you are using Eclipse
13. Some classes Google added in 2.1.0 changed in 2.1.1, so some code may not compile in GWT 2.1.0 (the PageRPC-mvp example is one). |