1、下載gwt-sdk,https://developers.google.com/web-toolkit/download
2、下載完成之后解壓,我解壓的目錄是D:\Program Files\gwt-2.5.1
3、配置環境變量,相信安裝過jdk的人都應該知道環境變量在那配置吧!設置path為你解決的的目錄,set path=path;D:\Program Files\gwt-2.5.1
4、進入你要生成項目的一個目錄下,按shift+右鍵點擊打開命令行,執行
webAppCreator com.hnhcc.gwt
5、在控制台自動生成項目demo
Created directory E:\gwtDemo\src Created directory E:\gwtDemo\src\com\hnhcc Created directory E:\gwtDemo\src\com\hnhcc\client Created directory E:\gwtDemo\src\com\hnhcc\server Created directory E:\gwtDemo\src\com\hnhcc\shared Created directory E:\gwtDemo\test Created directory E:\gwtDemo\test\com\hnhcc Created directory E:\gwtDemo\war Created directory E:\gwtDemo\war\WEB-INF Created file E:\gwtDemo\src\com\hnhcc\gwt.gwt.xml Created file E:\gwtDemo\src\com\hnhcc\client\GreetingService.java Created file E:\gwtDemo\src\com\hnhcc\client\GreetingServiceAsync.java Created file E:\gwtDemo\src\com\hnhcc\client\gwt.java Created file E:\gwtDemo\src\com\hnhcc\server\GreetingServiceImpl.java Created file E:\gwtDemo\src\com\hnhcc\shared\FieldVerifier.java Created file E:\gwtDemo\war\WEB-INF\web.xml Created file E:\gwtDemo\war\gwt.css Created file E:\gwtDemo\war\gwt.html Created file E:\gwtDemo\war\favicon.ico Created file E:\gwtDemo\.classpath Created file E:\gwtDemo\.project Created file E:\gwtDemo\gwt.launch Created file E:\gwtDemo\README.txt Created file E:\gwtDemo\build.xml
6、生成的文件中我們看到有build.xml為ant的構建文件和熟悉的.classpath和.project,所以可以直接把項目導入到myeclipse或eclipse下,其中gwt.java為主程序
7、先用ant構建一下項目,右鍵點擊build.xml文件run as antbuild
8、右鍵點擊gwt.java,profile as先建一個運行方式
9、點擊運行將彈出如下對話框
10、選擇在默認瀏覽器中打開,可能會出現沒有安裝瀏覽器插件之類的,為了以后開發可以安裝上,不過其實也不需要,gwt提供有兩種運行模式,Hosted Model和Web Model。
11、如果只是想簡單了解一下gwt的話,把瀏覽器的地址去掉gwt.codesvr=127.0.0.1:9997,改為http://127.0.0.1:8888/gwt.html