Netbeans: Setting up a Web project with SmartGWT

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:

webappcreator -out c:\dev\testgwt org.demo.TestGwtApp

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

lib/smartgwt.jar
lib/smartgwt-skins.jar

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

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

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

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

7. Update MyApp.gwt.xml

<inherits name="com.smartgwt.SmartGwtNoTheme" />

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

Did you like my blog post?

Signup now and receive an email when I publish new luv2code content.

I agree to have my personal information transfered to AWeber ( more information )

I will never give away, trade or sell your email address. You can unsubscribe at any time.

7 Comments

  1. Comments  bd_vic   |  Sunday, 26 February 2012 at 11:33 pm

    Thanks. Please help. How to update build.xml? What I have to do?

  2. Comments  Chád Darby   |  Thursday, 22 March 2012 at 8:56 am

    Hi,

    No need to update the build.xml. The generated build.xml that you get with webappcreator is all you need.

  3. Comments  Sam   |  Sunday, 16 July 2017 at 4:48 pm

    where can I find these libs
    lib/smartgwt.jar
    lib/smartgwt-skins.jar
    and where should I copy these to, lost here.

  4. Comments  Chad Darby   |  Sunday, 16 July 2017 at 5:28 pm

    Hi Sam,

    You can download them from here:

    http://www.smartclient.com/product/download.jsp

    Select the option “Download Smart GWT LGPL Edition”

    Unzip and you fill find the files:

    – smartgwt.jar
    – smartgwt-skins.jar

    Copy these to your WEB-INF/lib directory

    The zip also includes a quick start guide in the doc directory.

    For more questions or support, you can post on the SmartGWT forum: http://forums.smartclient.com/forum/smart-gwt-technical-q-a

    Good luck with SmartGWT. I used it on a project about 5 years ago. It was fun at the time, but I haven’t used it since.

    Cheers!

  5. Comments  Sam   |  Monday, 17 July 2017 at 12:31 pm

    I actually really like your videos on YouTube. That is where I learned JSP, JDBC from.
    Can you please do a video on SmartGWT too. I am not able to find any resources for GWT on Net-beans, Most of them are on Eclipse and or in different language.
    SmartClient form wont be as useful compared to a lecture from you as I am a total beginner.

  6. Comments  Chad Darby   |  Monday, 17 July 2017 at 12:56 pm

    Thanks for the video suggestion on SmartGWT. I’ll consider it for the future 🙂

  7. Comments  dcabee   |  Thursday, 03 May 2018 at 6:10 am

    You sir, are a lifesaver!!!

    Have been trying to do this for almost a week now and this is the only thing that finally got me going from setting up the environment to actually coding.

    Amazing stuff

Leave a Reply