Are you dazzled by the way you can drag Google Maps around or move from one place to another without having to reload the screen? Or maybe you're a fan of Gmail and its look and feel? If you want to develop Web sites with Google's signature user-friendly features but are afraid of the work involved, take a look at the Google Web Toolkit (GWT).
GWT, a tool for Web programmers, made its first public appearance in May 2006 at the JavaOne conference. It's in full development, and its current version is 1.4.61; version 1.5 is promised for Q1 2008. It's licensed under the Apache License 2.0, though some of its components are under other licenses.
Why would you use GWT?
What does GWT include?
GWT includes four components:
- Hosted Web browser: Allows you to test your Java application the same way end users would see it.
- Web interface library: Lets you create and use Web browser widgets, such as labels, text boxes, and radio buttons. You do your Java programming using these widgets, and the compilation process transforms them into HTML equivalents.
Installing and using GWT
Before installing this toolkit, you should already have installed the Java Development Kit (JDK). GWT is currently oriented to working with Eclipse, and that's what Google's own developers use, so you might want to get that as well. (You can also get GWT to work with NetBeans or other common development environments.) Then go to the download site, get the latest package -- it's about 25MB in size -- and extract it by using
tar jxf ../gwt-linux-1.4.61.tar.bz2. No further installation is required, and you can use GWT from any directory.
To create a new project, follow the GWT's instructions. If you're working with Eclipse, follow these instructions:
- Create a directory for your project.
- Create a project in the directory, using
./pathToGWT/projectCreator -eclipse MyOwnProject.
- Create a basic empty application with
./pathToGWT/applicationCreator -eclipse MyOwnProject com.yourCompanyName.client.YourApplicationName.
- Open Eclipse, go to File -> Import, choose Existing Projects Into Workspace, and select the directory in which you created your project.
You can now edit both the HTML and Java code, add new classes, and test your program in hosted mode. When you're satisfied with the final product, compile it (an appropriate script is generated when you create the original project) and deploy it to your Web server.
GWT is an innovative way of doing Web development. It allows Java programmers to produce Web applications, use the tools they're accustomed to, and work at a higher level, while producing modern, highly interactive Web sites.