Rich Internet Applications

This spring I completed a Friendster-like site for Ziff-Davis to host 5 gaming magazines and 10 million members. Their old site was based on ASP and did not have Friendster like capabilities. (In between gigs, Google contacted me about a job but it did not pan out). Then I find out that Friendster's implementation of Java was poor and they switched to PHP, a bit of a black eye for the Java community that was discussed on (Too bad they did not subcontract someone with production Java experience to help recover, not everyone "knows" Java hand on, some "know of" Java from books.

Hello World Rich Internet Application (RiA) Recipe


This spring I completed a Friendster like site for Ziff-Davis to host 5 gaming magazines and 10 million members. Their old site was based on ASP and did not have Friendster like capabilities. (In between gigs, Google contacted me about a job but it did not pan out). Then I find out that Friendster's implementation of Java was poor and they switched to PHP, a bit of a black eye for the Java community that was discussed on (Too bad they did not subcontract someone with production Java experience to help recover, not everyone “knows” Java hand on, some “know of” Java from books. This is why the Java community is sometimes perceived as “academic crap” )

Around this time, I began to realize that 80's technology such as HTML will go the way of the VT-100, as more and more people have broadband and larger screens, they want an MTV like experience. That's right, it makes no sense now to develop any HTML application that will be deployed in '05 and operated into '06. People are starting to expect rich content, such as . HTML is legacy to me. Let's see.

I even held a seminar, where we talked about RiA, Rich Internet Applications ( )
I also spent time writing Flex (by Neville), such as:

<mx:DataGrid  id="dg" dataProvider="{empD}"

<mx:RemoteObject    id="empSO"  source=""
       result="empD=event.result"  />
<mx:Script> <![CDATA[
 var empD;
 function initSO() {
  empSO.populate();    }
    function openDetail( o ) {
 ldr.load();    }
<mx:Loader id="ldr" source="zoom.mxml.swf" autoLoad="false" />

This code creates a datagrid, loads it via a service object called empSO and on the cellPress event, opens a popup of the details for that row. The datagrid can sort on the client which is one of the features that makes this an RiA app. I found Flex slow to render for non-trivial forms, therefore not a good enough candidate for RiA.


Java Desktop (by Davidson) (JDNC) is one example of an Open Source RiA toolkit, but ... we are jumping ahead.

RiA applications get deployed via the Internet and execute on the user's desktop and provide a rich media experience. One example of a futuristic killer app is iTunes.

Grid sorting and rendering executes on the client, not the server. Also, the UI is not sent back and forth to the server with each request, only data is sent.

Ok, back to Java Desktop. Java Desktop is sponsored by Sun, and it's open source under LGPL (so Sun is slowly open sourcing Java). Please do not confuse this with poor old Swing. You might say, “What does Java Desktop have to do with the server side?”. Unlike Client/Server, there is no DLL hell and upgrades of the application are cheap and effective. What makes it superior to MS technologies is Network Launcher (JNLP – aka WebStart, the annoying icon that gets installed when you install the JDK). It's so easy to install, upgrade and deploy, that in no time at all your desktop could be filled with little Network Launcher icons (and dare I say, Java would then own the desktop, right?). So the Java Desktop is great – it can be deployed, managed and upgraded by a remote network server.

The other thing about iTunes is that the software is free. Users now expect software to be free. Thanks to Apache, Firebird, OpenOffice and the like, the precedent has been set. And while it's becoming increasingly difficult to charge for software, one can charge for usage (per transaction, per month, etc.) so monitoring the RiA/SoA applications becomes key. Not only monitoring for security and performance, but also for money. As developers become operators of applications, new fortunes will be made.

Take for example It provides a CRM service for its customers but rather than a big upfront price tag, users are charged by the month. The software itself is free. The way software is sold today is akin to the way factories produced electricity in the days before there were electric utilities. Factories had their own electric generators such as a water wheel. These days of course, factories don't generate their own electricity; they buy what they need from the electric company.

From a business point of view, applications will soon become a utility just like electricity. They'll be offered on a pay-as-you-go basis, with RiA basically installed on demand, and disposable like a box of tissues.

Hello World

So since I found Flex too slow, let's do a hello world using Java Desktop (JDNC), notice I used JXFrame (Java Desktop), not JFrame (Swing):

  JXFrame frame = new JXFrame("RIA");
  JPanel tabCms = new JPanel(new BorderLayout());
  JButton butCms = new JButton("Populate CMS");
  _gridCms = new JNTable();
  tabCms.add(butCms, BorderLayout.NORTH);
  JTabbedPane tab = new JTabbedPane();
  tab.add("Cms", tabCms);

  butCms.addActionListener(this); //onClick

  display(frame); // standard pack and show

 public void actionPerformed(ActionEvent arg0) { //onClickExec
  DefaultTableModel model = new DefaultTableModel(10, 6);


Your Table could be more complex. You could for example use Google's API to show something more interesting. Take a look at the JavaDoc for JavaDesktop to do more.

This can run in an IDE for testing. For real development you can use (by Ferguson) to send messages or even SOAP (warped Doc/Lit for cross platform middleware). And you can use JGoodies (by Lentzsch ) for more advanced use. I found Spring is getting a bit more complicated and could be simplified. For example, it's more effective to use collections, the writing of getters and setters in lots of cases and be more loosely coupled.
For people that are learning Java, they can use something like this:

To deploy it on the server ... well there is a client piece we have to build, and a WAR, and I do it using Ant like this:

<project name="hello" default="war" basedir="..">

<target name="war" depends="helloria" >
 <path id="classpath">
 <pathelement location="hellosoa/misc/servlet-api.jar"/>
 <pathelement location="hellosoa/web/WEB-INF/lib/commons-beanutils.jar"/>
 <pathelement location="hellosoa/web/WEB-INF/lib/commons-chain.jar"/>
 <pathelement location="hellosoa/web/WEB-INF/lib/commons-collections.jar"/>
 <pathelement location="hellosoa/web/WEB-INF/lib/commons-digester.jar"/>
 <pathelement location="hellosoa/web/WEB-INF/lib/commons-logging.jar"/>
 <pathelement location="hellosoa/web/WEB-INF/lib/log4j.jar"/>

   <javac srcdir= "hellosoa/src"
 <war destfile = "helloria.war"

  <target name="helloria">
  <path id="classpath">
    <pathelement location="hellosoa/web/ria/jdnc.jar"/>
    <pathelement location="hellosoa/web/ria/jgoodies_forms.jar"/>
   <javac srcdir= "helloria/src"
 <jar destfile = "hellosoa/web/ria/riarun.jar"

The task above makes a JAR, and puts the client JAR in the WAR. For real development, I run commons-chains (by McClanahan; instead of IoC) on the server to send out DAO responses and go through a management layer.

Intranet users

A user would just surf to the WAR, and this index.jsp would “fire”:

<%@ page contentType="application/x-java-jnlp-file" %>
   StringBuffer codebaseBuffer = new StringBuffer();
<?xml version="1.0" encoding="UTF-8"?>
<jnlp codebase="<%=codebaseBuffer.toString()%>" href="index.jsp">
  <icon href="ria/splash.jpg"/>
 <icon kind="splash" href="ria/splash.jpg" />
    <j2se version ="1.4.2+" />
    <jar href="ria/riarun.jar"/>
 <jar href="ria/jdnc.jar"/>
 <jar href="ria/jgoodies_forms.jar"/>
   <property name="srvc" value="<%=codebaseBuffer.toString()+"/soasrv"%>" />
  <application-desc main-class="com.bp.ria.Start"/>

The reason I say Internet users is that while the “new” Sun has open source the Java Desktop, the “old” Sun is keeping Network Launcher proprietary and buggy.

or )

Unfortunately, IBM is driving behind Sun, and not getting into the passing lane to fix the issues and give people an alternative. Sun may not have the resources anymore. Open source does not wait, and there are several Network Launchers. I use netx.jar for Network Launcher like this:

java -jar netx.jar -jnlp http://host/webappfolder

People that have distaste for open source should not use this on the extra net. You can read more on: (by Bauer). The Sun Network Launcher does need to improve the requirements ( sandbox security is too restrictive)

Getting Started with the IDE

If you have a working environment that you are happy with, then you can just type in the code I showed. And if you don't... What I started doing is zipping up an environment and just unzipping a working one whenever I need it. The zipped folder includes everything I need, even the JDK.

You can download a working environment with the above source, but it is 300MB download from Just go to

  2. download and unzip to c:
  3. Unistall all the Java from your machine. In inst there is jdk1.5.exe, run and install in provided folders. Set up ANT_HOME and JAVA_HOME. Done! (FAQ: What if it does not work? A: It works for me.)
  4. You can now edit in Eclipse and hit http://localhost/manager/reload?path=/ to reload the classes, without re-starting Tomcat.

This way you can do RiA/SoA quickly. Why is it so big? It's everything I use to develop, including pgSQL, so I do not have to download or configure.


JSF made a lot of promises a year ago related to UI, and now those promises have all come true... but in the form of the Java Desktop. With RiA/SoA, we have a return to a Client/Server of sorts, but this time with better deployment and better management capabilities.

With modem use declining in favor of DSL and broadband, and monitors getting above 21” and more, people expect to have a “Cinematic” (by Laslo) experience and more of an MTV look and feel. No need to develop skills in portlets or Tapestry or other html areas, there is no ROI. Welcome RiA! No more cross browser and back button issues.

It does not make sense anymore to develop additional HTML legacy applications; HTML is done for.

The future will bring more declarative programing, such as Longhorn's XAML and the like:
(But some people will keep writing C code inside of C++, ie, you should start getting used to doing UI declaratively, just like in Struts we do validation declaratively, just more things are in XML). People interested in the operation of RiA/SoA applications can join an RiA/SoA forum community at Yes, it's a PHP forum. One of the goals of the site is to re-implement the entire site in the Java Desktop, replacing PHP. The other goal of the site is to find clients that want us to operate RiA/SoA applications for a monthly maintenance/admin fee. Development is free. (No, we don't do html) Send us a paper mock up and 1st month's check (ex: $100 per month per screen for 3 years, includes operation and free development). Qualified developers that want in can contact me. (Again, the example of iTunes is good, they too have free software, just to underline a possible new business model).

I plan to publish an advanced example based on a forum using the Java Desktop.

Thanks to the Java Desktop, Java has a fine opportunity to own the desktop, once the Network Launcher issues are tunned.

About the Author

Vic Cekvenich has been in software development and consulting for almost 20 years. He wrote the 1st book on Struts a year before anyone else and his new book is coming out in 3 languages:

Edited by B. Dunklau

Dig Deeper on Spring framework

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.