This document shows you how to set up a Netbeans Web project with SmartGWT.

System Requirements

  • GWT 2.2+: http://gwt.google.com
  • SmartGWT 2.4+: http://code.google.com/p/smartgwt/

1. Create GWT project using “webappcreator”

Open an MS-DOS window, type:

[code]
webappcreator -out c:\dev\testgwt org.demo.TestGwtApp
[/code]

2. Create a new NetBeans project, using the following steps

  1. Select File > New Project
  2. In the Choose Project step, select
  3. Categories: Java Web
  4. Projects: Web Application with Existing Sources
  5. Click Next
  6. In the Name and Location step,
  7. Click the Browse… button for the Location. Browse to the directory that was created in Step 1: c:\dev\testgwt
  8. Click Next
  9. Click OK to rename the build file to nbbuild.xml
  10. In the Existing Sources and Libraries step, click Next
  11. In the second Existing Sources and Libraries step, click Browse for Web Pages Folder
  12. Select the directory: war
  13. Click Finish

3. Copy SmartGWT libs

[code]
lib/smartgwt.jar
lib/smartgwt-skins.jar
[/code]

Note: these JARs are only needed for compilation. Do not put in WEB-INF/lib.

Update the NetBeans project to include lib/smartgwt.jar

4. Update build.xml to include these paths at compilation time: project.classpath

5. Add Skins to host HTML page
In HTML host page

[javascript]
<script type="text/javascript">
var isomorphicDir="testgwt/sc/";
</script>
[/javascript]

6. In host HTML page
Move the loading of module AFTER the isomorphic load. See below

[javascript]
<script type="text/javascript">
var isomorphicDir = "testgwt/sc/";
</script>
<script src="testgwt/testgwt.nocache.js" type="text/javascript"></script>
[/javascript]

7. Update MyApp.gwt.xml

[code]
<inherits name="com.smartgwt.SmartGwtNoTheme" />

<inherits name="com.smartclient.theme.enterpriseblue.EnterpriseBlue"/>
[/code]