a netbeans rcp blog

Bye bye Webstart Hello Update center

Posted by Nicklas Löf on October 19, 2010

I have always heard about Update centers and that Netbeans modules could be put into them and have the module being updated automatically… But I have always been frigthend about it because it sounds so complicated.. setting up your own update center.. sounds like a big installation needed but I have just found out it was so easy to do.

A few days ago we were about to go into a internal alpha prototype testing internally which would require lot of updates. Webstart have been the choice for a long time but there is so many strange things that can happen and I did run into some strange jnlp bug that caused some of my Modes not to work. Then I decided I have had enough! Lets look at that complicated Update center stuff!

Lets setup an Update center!
So what do we need? We need space on a web server. It can be any web server where you can upload your own files. You need this URL already in this stage. Now we need to enter this URL into our application. This can be done in two different ways. Either added to one of your existing modules. This is the way I did choose but have figured out later that the other way is probably better and that is to create a new module just for the update center information.

Either way choosen to add the URL is simple. RIght click-> New-> Module Development-> Update center. Enter your URL here. It should be something like http://www.yourdomain/updates/update.xml

Was that everything? Yes. Now your application will check for updates!

Create an installer
Next I decided to create an installable version of my application. It’s very easy, just select which installers you want to create in your Suite settings. (OSX, Solaris, Linux and Windows are supported). Then right click the suite and select Build installers and you will end up with installers. I built for Windows so I got an .exe

The only drawback I have found so far is that the installer seems to require JDK. I’m not 100% sure if it’s any of my module or suite settings that are causing this but my application runs just fine without a JDK installed.

It’s update time!
So lets say that you have an update in one of your modules and you want the users that have installed your application to get a notification about this. How can you do this?

Right click your module and select Properties. In the API versioning settings change the Specification Version number to 1.1 or maybe 1.0.1 if you don’t want to raise the versioning number so high.

Then right click your suite and select Create NBMs. And quite soon you will see a file link to where your updated modules are located. It’s the content of this folder that you need to upload to the server that you specified earlier. The files to upload is yourmodule.nbm, updates.xml and the licenses folder.

Update pushed to clients
And thats is everything needed! Your application will detect that there are changes and display a message that there are updates available. Just the same message you get when something in Netbeans IDE is updated. The user will select that he/she wants to update and the application will restart automatically and your updated module is loaded.

Update center in it’s own module
I had an issue today where my suite needed to download a module from the official Netbeans update center. But my problem was that I couldn’t add this update center into my clients because my module was requiring other modules and therefore the update couldn’t be installed. If I had put my update centers into a separate module I could have just updated that one and the application would had first update the update centers URLs and then download the required modules.

Word of the day: Update.. I have never typed that word so many time before I think 😉


One Response to “Bye bye Webstart Hello Update center”

  1. Henry Arousell said

    Brilliant as ever! Thank you Nicklas!

Leave a Reply

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

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

Google+ photo

You are commenting using your Google+ 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 )


Connecting to %s

%d bloggers like this: