<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.umiacs.umd.edu/adapt/index.php?action=history&amp;feed=atom&amp;title=Netbeans%3ANetbeansGWTLib</id>
	<title>Netbeans:NetbeansGWTLib - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.umiacs.umd.edu/adapt/index.php?action=history&amp;feed=atom&amp;title=Netbeans%3ANetbeansGWTLib"/>
	<link rel="alternate" type="text/html" href="https://wiki.umiacs.umd.edu/adapt/index.php?title=Netbeans:NetbeansGWTLib&amp;action=history"/>
	<updated>2026-04-07T13:51:25Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.7</generator>
	<entry>
		<id>https://wiki.umiacs.umd.edu/adapt/index.php?title=Netbeans:NetbeansGWTLib&amp;diff=1961&amp;oldid=prev</id>
		<title>Scsong at 23:10, 11 September 2008</title>
		<link rel="alternate" type="text/html" href="https://wiki.umiacs.umd.edu/adapt/index.php?title=Netbeans:NetbeansGWTLib&amp;diff=1961&amp;oldid=prev"/>
		<updated>2008-09-11T23:10:53Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;==Creating a GWT Library==&lt;br /&gt;
&lt;br /&gt;
In the &amp;#039;&amp;#039;GWT&amp;#039;&amp;#039; class, there is a &amp;#039;&amp;#039;GWT.log(String, Throwable)&amp;#039;&amp;#039; method but no &amp;#039;&amp;#039;GWT.log(String)&amp;#039;&amp;#039; method. Time to create a library of useful classes that other GWT applications can share!&lt;br /&gt;
&lt;br /&gt;
===Create the library===&lt;br /&gt;
&lt;br /&gt;
Create a new library project in &amp;lt;nowiki&amp;gt;NetBeans&amp;lt;/nowiki&amp;gt; and add the GWT to the libraries under the project properties. In this example, the project will be called =gwt-util-5=. &lt;br /&gt;
&lt;br /&gt;
Create the utility class:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
package edu.umiacs.gwt.util;&lt;br /&gt;
&lt;br /&gt;
import com.google.gwt.core.client.GWT;&lt;br /&gt;
&lt;br /&gt;
public class GWTUtil&lt;br /&gt;
{&lt;br /&gt;
    public static void log(String message)&lt;br /&gt;
    {&lt;br /&gt;
        GWT.log(message, null);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Create a &amp;#039;&amp;#039;ModuleName.gwt.xml&amp;#039;&amp;#039; and place it in the top-most source directory that does not contain code. In this example, the module will be called &amp;#039;&amp;#039;GWTUtil&amp;#039;&amp;#039; and it will be placed in the &amp;#039;&amp;#039;edu.umiacs.gwt&amp;#039;&amp;#039; directory. The file should contain:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;module&amp;gt;&lt;br /&gt;
   &amp;lt;inherits name=&amp;quot;com.google.gwt.user.User&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;source path=&amp;quot;util&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/module&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The source element specifies which directories contain translatable code and is relative to the location of the xml file. If not specified, it defaults to &amp;#039;&amp;#039;client&amp;#039;&amp;#039;. &lt;br /&gt;
&lt;br /&gt;
===Include the library===&lt;br /&gt;
&lt;br /&gt;
In the hello world application, use the brand new method! Change:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
GWT.log(&amp;quot;onModuleLoad()&amp;quot;, null);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
to:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
edu.umiacs.gwt.util.GWTUtil.log(&amp;quot;onModuleLoad&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the project properties of the hello-world project, add the gwt-util project to the libraries. &lt;br /&gt;
&lt;br /&gt;
Include an inherit element in the module xml file of the hello-world project. The module xml file should now be:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;module&amp;gt;&lt;br /&gt;
   &amp;lt;inherits name=&amp;quot;com.google.gwt.user.User&amp;quot;/&amp;gt;  &lt;br /&gt;
   &amp;lt;inherits name=&amp;quot;edu.umiacs.gwt.GWTUtil&amp;quot;/&amp;gt;        &lt;br /&gt;
   &amp;lt;entry-point class=&amp;quot;edu.umiacs.gwt.hello.client.HelloWorldApp&amp;quot;/&amp;gt;      &lt;br /&gt;
   &amp;lt;servlet class=&amp;quot;edu.umiacs.gwt.hello.server.HelloWorldServiceImpl&amp;quot; path=&amp;quot;/hello-service&amp;quot;/&amp;gt;        &lt;br /&gt;
&amp;lt;/module&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The name is the java-ish path to the xml file, minus the &amp;#039;&amp;#039;.gwt.xml&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
Now include the gwt-util source and class directories to the &amp;#039;&amp;#039;run&amp;#039;&amp;#039; and &amp;#039;&amp;#039;-compile-to-javascript&amp;#039;&amp;#039; targets in the hello-world &amp;#039;&amp;#039;build.xml&amp;#039;&amp;#039; file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;target name=&amp;quot;run&amp;quot; depends=&amp;quot;init,compile&amp;quot;&amp;gt;&lt;br /&gt;
   &amp;lt;java classpath=&lt;br /&gt;
&amp;quot;${run.classpath}:${basedir}/build/classes:${basedir}/src:${project.gwt-util-5}/build/classes:${project.gwt-util-5}/src&amp;quot; &lt;br /&gt;
         classname=&amp;quot;com.google.gwt.dev.GWTShell&amp;quot; &lt;br /&gt;
         fork=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;arg value=&amp;quot;-out&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;arg path=&amp;quot;${build.www.dir}/&amp;quot;/&amp;gt;          &lt;br /&gt;
      &amp;lt;arg value=&amp;quot;edu.umiacs.gwt.hello.HelloWorld/HelloWorld.html&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/java&amp;gt;&lt;br /&gt;
&amp;lt;/target&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
&amp;lt;target name=&amp;quot;-compile-to-javascript&amp;quot;&amp;gt;&lt;br /&gt;
   &amp;lt;echo message=&amp;quot;Compiling Java to JavaScript&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;java classpath=&amp;quot;${run.classpath}:${basedir}/src:${project.gwt-util-5}/src&amp;quot; &lt;br /&gt;
         classname=&amp;quot;com.google.gwt.dev.GWTCompiler&amp;quot; &lt;br /&gt;
         fork=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;arg value=&amp;quot;-out&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;arg path=&amp;quot;${build.dir}/www/&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;arg value=&amp;quot;${application.args}&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;arg value=&amp;quot;edu.umiacs.gwt.hello.HelloWorld&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;/java&amp;gt;&lt;br /&gt;
&amp;lt;/target&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For more information: [[media:gwt-tutorial-5.tar.gz|GWT Tutorial 5]]&lt;/div&gt;</summary>
		<author><name>Scsong</name></author>
	</entry>
</feed>