2009
10.24

Quickly Install most CODECs in Ubuntu

Recipe to install most CODECs on Ubuntu:

(Note: on a 64 bit system, substitute ‘w64codecs’ for ‘w32codecs’)

For an application to copy DVDs:

Here is a good reference: Ubuntu Guide

2009
10.23

Set up GWT application with Maven

This demo is based on:

  • GWT libraries 1.6.4
  • Apache Maven 2.2.1
  • GWT Maven plugin 1.1

Before you start your GWT application, you need to figure out:

  • Package and name of your module, e.g. org.package.Module. In the example, ‘org.package’ is the package name; ‘Module’ is the module name; and, ‘org.package.Module’ is the full module name.
  • Maven group and artifact id for your application

To create a GWT application using maven, use the following recipe:

1. Create regular WAR project/module, using Java 1.5 or above.

1.a. Using maven create module

> mvn archetype:create -DarchetypeGroupId=org.apache.maven.archetypes -DarchetypeArtifactId=maven-archetype-webapp -DgroupId=<group-id> -DartifactId=<artifact-id>

1.b. Use Java 1.5. Edit the pom.xml file created in the previous step and add:

2. Edit pom.xml:

2.a. Add maven GWT plugin

2.b. Add desired version of GWT as a property

2.c. Add dependencies on needed libraries

3. If a web.xml file was not created during module creation, then you must provide one. This is necessary to create a WAR module. In /src/main/webapp/WEB-INF/web.xml :

*** At this point, you have a GWT maven module.

> mvn package

will create a WAR file. However, no GWT code is generated. ***

4. Create a GWT module file. A module file is a XML file with a name that ends with ‘.gwt.xml’. In Maven, the GWT module file is a resource, therefore it must be located under /src/main/resource. One has to determine the location of the file from the package name. Therefore, if the fully qualified name of the module is ‘org.package.Module’, then one needs to create a file called ‘/src/main/resource/org/package/Module.gwt.xml’.

The location of the module file in relation to the entry point class is important. Consistency is really important in the names.

You have to adjust the values in the file: JS_DIR, ORG.PACKAGE.client.MainView and STYLE.css. Those values are dependent on your installation.

JS_DIR is the directory in the WAR structure under which generated files will be located.

org.package.client.Main is the name of the entry point class. (See point below)

STYLE.css is the style sheet used. This is a stylesheet added to page when the entry point class is run. This file should be found in the ‘public’ portion of the application. It is packaged with the generated javascript files by the GWT compiler.

5. Create a public directory. Under the resource directory that contains the module file, create a sub-directory called ‘public’. In this directory, put the resource files that need to be accessible by the application. For example, style sheets and images can be placed there. Files located in the public directory are copied in the generated directory by the GWT compiler.

6. Create a GWT entry point class. A GWT entry point class defines the mainline of a module. This is written in Java. Therefore, the file defining the entry point class must be located under /src/main/java. All Java files destined for the client GUI must reside in a sub-package of the module called ‘client’. Therefore, if one wanted to name the entry point class ‘Main’ for the ‘org.package.Module’ module, the the fully qualified name for the class would be org.package.client.Main. Therefore, one would create a file named ‘/src/main/java/org/package/client/Main.java with the following content:

*** At this point, the maven GWT plugin should be generating javascript code from the java source code. A number of files can be found here:

…/target/${project.name}/JS_DIR

Opening the war file, the same generated scripts should be found under …/JSDIR

***

7. Create an HTML file that uses the generated scripts. Under the directory …/src/main/webapp, create a file called “index.html” with the following content:

Above, you need to adjust the values for JS_DIR, as specified in previous points.

*** At this point, you have a complete GWT application. The WAR file is generated by:

> mvn package

The generated WAR file can be deployed on a servlet container (Tomcat, Jetty, etc.) The web.xml file specifies to load index.html as default, and index.html loads and runs the generated javascript module.

***

The complete directory structure is

2009
10.23

Welcome

Welcome to Bits By The Pound! You have reached a page where technology enthusiasts can talk about their passion.