Forum Controls
Spotlight Features

The Rich Engineering Heritage Behind Dependency Injection

Andrew McVeigh takes us on a tour of the rich heritage behind dependency injection, what it represents, and tells us why its here to stay.
Replies: 5 - Pages: 1  
Threads: [ Previous | Next ]
  Click to reply to this thread Reply

Getting started with Google Web Toolkit (GWT)

URL: ZDNet

At 9:35 PM on May 31, 2006, Ed Burnette Javalobby Junkies wrote:

Getting started developing with Google Web Toolkit is easy. First you need a copy of Java. Although it works with older versions (such as the IBM JRE 1.4.2 that came with my Thinkpad), you might as well get the latest Sun JDK 5.0 update or the latest JDK 6.0 snapshot .

Note: Sun has a taken a page from Microsoft's playbook and bundled their NetBeans IDE in the 5.0 JDK. However this is often an *older version* of the JDK (for example as of this writing it's back at update 6 while the regular JDK download is at update 7), and this kind of bundling should be discouraged anyway. Fortunately, you can still get just the plain JDK without NetBeans and save yourself 70MB of extra downloading at the same time.

Second, you need a copy of the Eclipse IDE. Although it should work with Eclipse 3.1.2, you might as well get the latest Eclipse 3.2 release candidate. Go to the Eclipse downloads page , pick 3.2RC6 (or later), and then get the Eclipse package for your platform (Windows, Linux, Mac, etc.). You can either get the full SDK (the one that has all the sources and programmer documentation), or you can just get the Platform Runtime Binary (34MB) plus the JDT Runtime Binary (19MB), for a total of 53MB.

Note: In a future version of Eclipse I hope this will be easier, perhaps with an install program and better compression that will make it even smaller and easier. But for now, you have to use a zip or gzip program to unpack it yourself.

Next, download and unzip the Google Web Toolkit itself and you're ready to create your first project.

Note: Right now there are no Eclipse plug-ins to create a GWT project so you have to do some manual steps at this point. Hopefully that void will be filled soon.

At a command prompt, run these commands (Substitute the appropriate paths for your system):

cd c:\gwt-projects
mkdir MyProject
cd MyProject
projectCreator -eclipse MyProject
applicationCreator -eclipse MyProject \
com.mycompany.client.MyApplication

The projectCreator and applicationCreator commands are two shell scripts that are supplied as part of GWT, so you'll need to specify the path to them or add the GWT directory to your system PATH variable. "MyProject" and "MyApplication" are just example names; you can use anything you want.

Now start up Eclipse and import this project into your workspace (File > Import > Existing Projects Into Workspace). The project will build and if all is successful you will end up with something like this:

Burnette_gwt_project.png

If you follow Google's Getting Started instructions it says to just click on the green "Run" button to get your project started in "hosted" mode, but that's not quite correct. Plus, you'll want to run the program in Debug mode most of the time anyway. So select Run > Debug..., and click on the launch configuration titled MyApplication (under Java Application). Then click on Debug. Two windows will appear: The GWT Development Shell (this is kind of like a console window) and the Wrapper HTML window (a special web browser).

Burnette_gwt_MyApplication.png

Verify that the application works by clicking on the 'Click me' button. The text "Hello World!" will appear.

Ok, now for the neat part. Leave the application running and switch back to the Eclipse window. Set a breakpoint in the onClick() method in MyApplication.java by double-clicking the "gutter" area next to the line:

Burnette_gwt_MyApplicationBreakpoint.png

Then switch over to the application window and click the 'Click me' button. Eclipse will stop at the line in your Java code where you put the breakpoint. Hmm, that's Java code, yet you're writing an Ajax application that will eventually be deployed in pure JavaScript. All the power of Eclipse, the debugger, refactoring, source management, etc. is suddenly available in the Ajax world. Can you begin to see the potential of this technology?

Well that's enough for now. Google has put together some pretty nice documentation on GWT but I'll be writing more about it from my own unique perspective as I put it through its paces. Let me know if there are any particular areas you want me to explore, and be sure to check out the GWT Forum for support from all the other GWT users and developers.

This article originally appeared on Ed Burnette's Dev Connection blog at ZDNet.

  Click to reply to this thread Reply
1. At 6:45 AM on Jun 1, 2006, Alex Blewitt DeveloperZone Top 100 wrote:

Re: Getting started with Google Web Toolkit (GWT)

Good work, Ed. You could almost have a mini-series of How-Tos on the GWT here :-)

Alex.
  Click to reply to this thread Reply
2. At 10:36 PM on Jun 4, 2006, deng.yin Javalobby Newcomers wrote:

Re: Getting started with Google Web Toolkit (GWT)

Could I invoke Spring service method in "onClick" method?
  Click to reply to this thread Reply
3. At 9:41 AM on Jun 5, 2006, Ed Burnette Javalobby Junkies wrote:

Re: Getting started with Google Web Toolkit (GWT)

Some people have been successful in getting GWT and Spring to work well together. See for example this article .
Ed Burnette
Author, Google Web Toolkit, Eclipse IDE Pocket Guide, Eclipse in Action
ZDNet blogger, Dev Connection; former Top Eclipse Ambassador.
  Click to reply to this thread Reply
4. At 2:00 PM on Mar 4, 2007, phuhoapro Javalobby Newcomers wrote:

Re: Getting started with Google Web Toolkit (GWT)

Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\Documents and Settings\thanhlong>d:

D:\>cd Study\AJAX\GoogleWebToolKit_Ajax\gwt-windows-1.3.3\gwt-projects\MyProject


D:\Study\AJAX\GoogleWebToolKit_Ajax\gwt-windows-1.3.3\gwt-projects\MyProject>pro
jectCreator -eclipse MyProject
'java' is not recognized as an internal or external command,
operable program or batch file.

D:\Study\AJAX\GoogleWebToolKit_Ajax\gwt-windows-1.3.3\gwt-projects\MyProject>
can you tel me this error?? (I've been cofig with Path.)
  Click to reply to this thread Reply
5. At 12:51 PM on Dec 6, 2007, Scott R Javalobby Newcomers wrote:

Re: Getting started with Google Web Toolkit (GWT)

You need to set the Path environmental variable to where the gwt directory is. Here's a post:
http://techron.blogspot.com/2007/12/setting-path-environmental-variable-in.html

thread.rss_message