GWT Client Development with NetBeans IDE – Simple Setup Example

GWT client development can be done simply with the original NetBeans IDE, without the special GWT4NB add-on. The add-on is more for development involving the server side. As a client-only GWT tool, it improves the development productivity greatly.

The setup is all documented in this README file on github:

Files:

gwt-linux-1.7.1.tar.bz2

https://developers.google.com/web-toolkit/versions

Install
==========

JDK and NetBeans
Installed in $HOME/bin/jdk1.6.0_25 and $HOME/bin/netbeans.
Will use the ant coming with NetBeans.

Set .bash_profile:

 JAVA_HOME=$HOME/bin/jdk1.6.0_25
 export JAVA_HOME

 ANT_HOME=$HOME/bin/netbeans/java/ant
 export ANT_HOME

 PATH=$JAVA_HOME/bin:$PATH
 PATH=$ANT_HOME/bin:$PATH

 export PATH

On Fedora 14, install compat-libstdc++-33 for the hosted mode to work. 

Run Example Hello
==================

cd work/gwt-linux-1.7.1/samples/Hello
ant hosted

Run Example Hello Out-of-the-tree
==================================

cd work
mkdir build
cp -a gwt-linux-1.7.1/samples/Hello ./build
cd build/Hello

Edit build.xml to change gwt.sdk pointing to ../../gwt-linux-1.7.1

ant hosted

Run Example Hello Out-of-the-tree in NetBeans
==============================================

Create a java project with existing code using the same work/Hello 
directory for the project. Netbeans will add two files to Hello 
directory. Ignore them. Use file window in Netbeans, right click 
on build.xml node, and run build or hosted target. The ant inside 
Netbeans will just build everything as if you are doing it from 
command line. 

To have the sample Hello to build please add the gwt-user.jar 
to the library. To have the sample Showcase to build please 
add also gwt-dev-<os>.jar, because the java code need to generate 
also the source code into the HTML pages. 

Run on Windows 64bit 
======================

Install JDK 64bit. 
Install Netbeans JavaSE.
Install JRE 32bit. 

Edit build.xml: 
[1] "gwt.sdk" same as mentioned above.
[2] Change the target "java" under "hosted" to have an extra value for 
    property jvm: jvm="C:\\Users\\whoami\\Programs\\jre6.32\\bin\\java".
    The path is the jre 32bit installation.

Debug with Java Debugger
=========================

Refer to page 96 of "Beginning Google Web Toolkit From Novice to Professional" 
 by Bram Smeets, Uri Boness, and Ronald Bankras
 Apress, 2008

java -Xdebug \
  -Xrunjdmp:transport-dt_socket,address=127.0.0.1:52996,suspend=y,server=n \
  -cp "$APPDIR/src:$APPDIR/bin:$GWT_HOME/gwt-user.jar:$GWT_HOME/gwt-dev-linux.jar" \
  com.google.gwt.dev.GWTShell -out "$APPDIR/www" "$@" \
  com.abc.gwt.GWTasks/GWTasks.html

Options for Hosted Mode 
=========================

java -cp gwt-dev-<your platform here>.jar com.google.gwt.dev.HostedMode
Missing required argument 'module[s]'
Google Web Toolkit 1.7.0
HostedMode [-noserver] [-port port-number | "auto"] [-whitelist whitelist-string]
  [-blacklist blacklist-string] [-logLevel level] [-gen dir] [-style style] [-ea]
  [-server servletContainerLauncher] [-startupUrl url] [-war dir] [-extra dir]
  [-workDir dir] [-localWorkers count] module[s]

where
  -noserver      Prevents the embedded web server from running
  -port          Specifies the TCP port for the embedded web server (defaults to 8888)
  -whitelist     Allows the user to browse URLs that match the specified regexes (comma or space separated)
  -blacklist     Prevents the user browsing URLs that match the specified regexes (comma or space separated)
  -logLevel      The level of logging detail: ERROR, WARN, INFO, TRACE, DEBUG, SPAM, or ALL
  -gen           The directory into which generated files will be written for review
  -style         Script output style: OBF[USCATED], PRETTY, or DETAILED (defaults to OBF)
  -ea            Debugging: causes the compiled output to check assert statements.
  -server        Specifies a different embedded web server to run (must implement ServletContainerLauncher)
  -startupUrl    Automatically launches the specified URL
  -war           The war directory to write output files into (defaults to war)
  -extra         The directory into which extra, non-deployed files will be written
  -workDir       The compiler work directory (must be writeable; defaults to a system temp dir)
  -localWorkers  Specifies the number of local workers to use when compiling permutations
and
  module[s]      Specifies the name(s) of the module(s) to host
About these ads

About minghuasweblog

a long time coder
This entry was posted in AJAX and Webapp, All, Java/JavaScript, Mozilla Firefox and Thunderbird, Software and tagged , , , , , , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s