Geertjan's Blog

  • November 3, 2006

Deploying Swing as an Application Client to GlassFish

Geertjan Wielenga
Product Manager
There are some great resources, created by NetBeans engineer Lukas Jungmann, for creating application clients on top of the NetBeans Platform:

The process is, in summary, like this: you create your Swing application as usual, on top of the NetBeans Platform. Then you use a wizard in the IDE to create an enterprise application, containing an application client module. And then the workarounds begin (which will be smoothed out in the coming period). First you add an Ant script to the enterprise application's build file, for copying the Swing application's JARs to the enterprise application at deployment. And then you add quite a bit of Java code (copied and pasted from the first resource above) to the Main method of the application client project. And then you run the enterprise application. GlassFish (the Sun Java System Application Server) starts up, and in the Runtime window you can see that your application is deployed:

In my case, I deployed the sample I use in NetBeans Platform demonstrations, i.e., a simplified version of a JFugue MIDI generator:

So, what this means is that, with a few workarounds (which will be fixed in the coming months), you're actually able to deploy Swing applications to GlassFish, as an application client. You could, for example, now communicate with the server. Maybe you'd like to create an explorer view on the NetBeans Platform, for listing deployed EJB modules, for example. Must be many other reasons for working with application clients on the NetBeans Platform, judging from the number of questions I've seen about this. I did get some errors, even after successfully deploying, but I guess we'll have to live with that until a more solid approach is created.

Join the discussion

Comments ( 1 )
  • Vincent Cantin Sunday, August 31, 2008

    This technic doesn't seem to allow a nb module to be directly run on Netbeans IDE like any other nb module.

    How about now, do we have a technic to have a nb module calling some EJB without altering the launch of the platform?

Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.