SmartGWT with Eclipse

This little HowTo describes how to create and configure a SmartGWT 2.2 project in the Eclipse IDE. SmartGWT extends the Google Web Toolkit Library with many nice UI Widgets. 1)

Prerequesites

Of course you need to have installed the latest JDK and Eclipse for Java Developers. The installation of the Google WebToolkit Eclipse Plugin is descirbed very nicely in their docs. Download SmartGWT an extract smartgwt.jar to your preferred library location.

Create new project in Eclipse

  • In Eclipse → File → New → Java Project
  • Enter Project Name, next
  • Later the ‚Default output folder needs to be set to <project>/war/WEB-INF/classes.2)
  • Go to tab ‚Libraries‘ → Add Library
  • Add Google Web Toolkit (and maybe Google App Engine, if you want it.)
  • Choose ‚User Libray‘ → next
    • If you haven’t setup SmartGWT as a User Libray in Eclipse already, then
    • Click ‚User Libraries …‘ → then in Preferences click ‚New …‘ → Enter Name ‚SmartGWT 2.2‘
    • Add Jars … → Browse to smartgwt.jar that you extracted in step one.
  • You now should be able to select ‚SmartGWT 2.2‘ as a user library and add it.

Your project settings should now look like this:

smartgwt_projectsettings

 

Copy Sources from Showcase Example

smartgwt_directory_structureCopy all java source files

  • from the place where you extracted smartgwt-2.2\samples\Showcase\src
  • into the existing src/ directory of your Eclipse Project in your Eclipse Workspace

Copy the whole war/ directory

  • from the place where you extracted smartgwt-2.2\samples\Showcase\war
  • into your java project’s direcotry.

(This manual copying of files might seem unusual. I know that there would be an ‚Import project‘ feature in Eclipse. But that only works, if the project to import, already had the eclipse specific .project file and the .settings/ dir, which the current SmartGWT/sample/showcase directory has not.)

Rebuild

Back in Eclipse, right click on the project and select ‚Refresh‘. If your ‚Project‘ menu is set to ‚Build automatically‘ then Eclipse will automatically do a complete rebuilt

Check that Project → Properties → Java Build Path → Source → Default output folder is set to SmartGWT_ShowCases/war/WEB-INF/classes

Start

1) If you got what these two sentences mean at all, then you are a geek this HowTo is right for you
2) In my case the Google Web Toolkit Compiler even did that automatically for me.