Creating GWT application using Eclipse

  • Share
  • Sharebar
  • Share

As you probably know, Google Web Toolkit is the toolkit that Google uses for all its application (Gmail, Reader, Google Docs etc).  I downloaded following components to get started, but following the instructions on GWT Getting started wasn’t as easy as I had thought. I had to search the google groups, and try variety to combination to successfully run my sample application from inside Eclipse.

I’ve put together these instructions so that others may be able to leverage from my experience and get going quickly.

Setup

I have following versions. If you are using different version, there may be slight changes to the menus you may see, but it should not differ a whole lot.

  • Windows XP SP2
  • Java SDK 1.6.0.10
  • Eclipse Ganymede SR1 aka Version: 3.4.1 (Build id: M20080911-1700 to be specific)
  • GWT  1.5.3

Creating the Sample Application

GWT’s Getting started page doesn’t talk about from which location to invoke the projectCreator and applicationCreator commands. That is probably the biggest problem. Run the projectCreator from your Eclipse Workspace area. It is important that you change the directory to newly created MyApp folder to execute applicationCreator.

Importing into Eclipse

If you have your -shell, -compile, .launch as well as .project command in same folder, then you are probably going to be OK.

From Eclipse select File->Import. Choose Existing Projects into Workspace, and point to your Eclipse Workspace folder. Eclipse will automatically select MyApp folder (since it sees .project file there)

Instead of Run->Run, check to see if you see two options when you click the drop down arrow next to the green Run icon. You should see ApplicationCreator and MyApp. Click on MyApp. The default is Application creator, which gave me class-not-found error.

Following is the output from my Command Prompt Window, for your reference

E:\EclipseWS\GWT>D:\gwt-windows-1.5.3\projectCreator.cmd -eclipse MyApp -out MyApp
Created directory MyApp\src
Created directory MyApp\test
Created file MyApp\.project
Created file MyApp\.classpath

E:\EclipseWS\GWT>cd MyApp

E:\EclipseWS\GWT\MyApp>d:\gwt-windows-1.5.3\applicationCreator.cmd -eclipse MyApp com.mycompany.client.MyApp
Created directory E:\EclipseWS\GWT\MyApp\src\com\mycompany
Created directory E:\EclipseWS\GWT\MyApp\src\com\mycompany\client
Created directory E:\EclipseWS\GWT\MyApp\src\com\mycompany\public
Created file E:\EclipseWS\GWT\MyApp\src\com\mycompany\MyApp.gwt.xml
Created file E:\EclipseWS\GWT\MyApp\src\com\mycompany\public\MyApp.html
Created file E:\EclipseWS\GWT\MyApp\src\com\mycompany\public\MyApp.css
Created file E:\EclipseWS\GWT\MyApp\src\com\mycompany\client\MyApp.java
Created file E:\EclipseWS\GWT\MyApp\MyApp.launch
Created file E:\EclipseWS\GWT\MyApp\MyApp-shell.cmd
Created file E:\EclipseWS\GWT\MyApp\MyApp-compile.cmd

Share Your Thoughts