Silent Update of RCP Application as NetBeans Module Sample

I got many requests to showing how to update Netbeans RCP Application silently. I blogged about long time ago - how_to_update_netbeans_platform including some code snippets. Right now I published on a NetBeans Module Sample Sample Silent Update which allows you to add a sample doing Silent Update directly to your application.

How to try it?

  1. Use recent NetBeans 6.9 builds (This sample works since NetBeans 6.9 or newer, if needed it can be backported to, say to NetBeans 6.5).
  2. Open your RCP Application. As a example I got Sample CRUD Application.
  3. Invoke Tools|Plugins, switch in Downloaded tab, add Plugin org-netbeans-modules-apisupport-silentup date.nbm and install it. It's hosted in
  4. Now we can use the newly added template Sample Silent Update
  5. In 3rd step in New Project Wizard specify a Update Center where application's updates will be published. As a sample you can use which contains a update of Silent Update Sample itself to proof of concept.
  6. Now, Silent Update module will appear beside other your application modules.
  7. Add Silent Update module into your application.
  8. Resolve missing dependencies in your application if needed.
  9. Run your application. After while, all available update will be downloaded and prepared for install. Before next start of your application, the updates will be installed. In the case you using the Sample Update Center, a update of Silent Update module will be installed.
  10. That's all. All sources of Silent Update are now present in your application thus you can modify them and adding new feature if needed.
Enjoy Silent Update Sample and you are welcome with your feedback.

hi Rechtacek's,
i just want to tell thanks for this help me to integrate auto update service in my application. I test it and it's work perfectly. i just want to know now if i can change the link of the server where you hosted ur update xml file and how can i get the file to add some features.i also want to know how the update's checking happen: for example in your xml file your nbm file is called"org-netbeans-modules-autoupdate-silentupdate.nbm" if i put a new version getting the same name,how the application will know that the file there is a new version or i have to change something in the 'update.xml' file?
one more time thanks
Best regards.

Posted by patrick on June 24, 2010 at 04:59 AM CEST #

i want also to know how an i modify your cod to do that when there is an update module available every time when i run my project the small green icon on the bottom stay untill i validate it.i notice that it is there only one time and when i have click on it first time, if after sometimes another update is available the application download and instal it whithout show me that icon again.
Best regards

Posted by patrick on June 24, 2010 at 11:27 AM CEST #

it's me again.Exkuz me if i ask so much but i want to understand well auto update service.this is my problem now:i create a nbm file with keystore and others(i follow instruction in the definitive guide to netbeans platform) i create a xml file like yours indicating place where to find nbm file but when i run my project i have this message on the ouput screen "none for instal" i don't know if it's my nbm file which is not good.please help me
thanks for answer

Posted by patrick on June 24, 2010 at 11:32 AM CEST #

Hi Patrick. Ad your 1st question: new version of module is identified by an attribute Specification Version. If a installed module has specification version lower than specification version of the same module in update.xml then it's a update. It means, if you add some new feature to your module, don't forget to increase the specification version your module.
Ad 2nd, showing a notification icon on the bottom is out of scope this application. try to check out Geertjan's blog at or my older posts, maybe there is some related.
Ad 3rd, it's probably depends if specification version declared in updates.xml for your NBM file is higher than already installed version. Anyway, for more verbose output this application you can run your application with switch -J-Dorg.netbeans.modules.autoupdate.silentupdate.level=FINEST.
Hope it helps.

Posted by Jiri Rechtacek on June 25, 2010 at 05:50 AM CEST #

hi jiri,
thanks for your help.I apply what u say, i have change the version of my module and it wors. Now i'm trying to to make an xml file from which my application can download more than 1 nbm file i read about module group and i will try it i hope it will work at first time. thanks one more time
Best regards.

Posted by patrick on June 25, 2010 at 07:56 AM CEST #

can you please tell me how can i make my application restart after downloading updates?i set the "needrestart" attribute to 'true' but after downloads complete nothing happen, i'm obliged to restart manually my application.if it's possible i want to implements it in your code(add a joptionpane asking at the user if yes or no he wants to restart now as usual application).if there is another way to do it i will be so glad to know it.
Another thing is that i want to know how can i make my project to download automatically new module(which doesn't exist at the deployement) and integrate it silently as the silent update(i don't want the user do it manually like when wewant to add pluggin for exmple)
thanks for answer
Best regards

Posted by Patrick on June 25, 2010 at 09:36 AM CEST #

Ad restart: to restart you application after installing NBMs you have to modify code of Silent Update Application - in the method UpdateHandler.handleInstall() use instance of class Restarter as a parameter for OperationSupport.doRestart. Don't forget to notify users before restarting the application.

Posted by Jiri Rechtacek on June 30, 2010 at 08:13 AM CEST #

hi jiri,
i see in your blog a method named "dorestartnow" i add it in silent update i run the projet but nothing happen iadd this in UpdateHandler class:
static void doRestartNow(InstallSupport support, Restarter restarter) throws OperationException {
ProgressHandle installHandle = ProgressHandleFactory.createHandle("update(s)-install-handle");
support.doRestart(restarter, installHandle);
and this is how i modify testHandleUpdates() but i don't have any notify when the update is done(i also put needrestart in xmlfile at true)

public void testHandleUpdates() throws Exception {
Collection<UpdateElement> updates = UpdateHandler.findUpdates();
OperationContainer<InstallSupport> container = UpdateHandler.feedContainer(updates, true);
InstallSupport support = container.getSupport();
Validator validator = UpdateHandler.doDownload(support);
assertNotNull("Validator found.", validator);
Installer installer = UpdateHandler.doVerify(support, validator);
assertNotNull("Installer found.", validator);
Restarter restarter = UpdateHandler.doInstall(support, installer);
assertNotNull("Restarter found.", restarter);
NotifyDescriptor d = new NotifyDescriptor.Confirmation("You must restart to complete update:do you want to restart now?", "Update", NotifyDescriptor.YES_NO_OPTION);
if (DialogDisplayer.getDefault().notify(d) == NotifyDescriptor.YES_OPTION) {
UpdateHandler.doRestartNow(support, restarter);
do iforgot something?

Posted by Patrick on July 01, 2010 at 11:08 AM CEST #

That would be cool if the Kenai project had a forum where users can post questions, and a Wiki which explains how to use the project. Otherwise, new users just can use it at all unless they are lucky enough to find this page by luck.

Posted by Vincent on July 13, 2010 at 07:21 AM CEST #

I meant "can't" instead of "can".

Posted by Vincent on July 13, 2010 at 07:28 AM CEST #

I added a link here to project description on Kenai, at least.

Posted by Jiri Rechtacek on July 13, 2010 at 09:40 AM CEST #

Thanks for the excelent app silent update. Now I'm having some problems to implement Uninstall feature. How can i look on updates.xml and compare with installed modules to find who is missing on XML. Whit that information a can know what module i have to unistall. Can you provide some example. Again, thank you!


Posted by Thiago Bonfante on November 17, 2010 at 04:22 AM CET #

Its not necessary any more, thanks anyway. I've done some parsers to update.xml and get to the point (If someone interested just mail me thiagobonfante at gmail dot com). Now I'm trying to check the repository not only on startup, but every hour, it is possible? Thanks.

Posted by Thiago Bonfante on November 19, 2010 at 11:52 AM CET #

@check the repository not only on startup, but every hour: AFAIK, it's possible. Phrased from - "Launch with -J-Dplugin.manager.check.interval=60 - to check it every hour. or modified etc/netbeans.conf". I don't sustain Plugin Manager for a long time but I guess it should work. If not, file a bug.

Posted by Jiri Rechtacek on November 19, 2010 at 12:15 PM CET #


I have some problems running my netbeans application inside java web start. The problem is regarding plugin management. It is not possible to deactivate and uninstall plugins. It works perfectly ok when I ran the application in standalone mode.

I found somewhere that this is not supported in netbeans. Is that corret or can I solve it in some way?

Posted by Pelle Karlsson on March 09, 2011 at 07:06 AM CET #

Post a Comment:
  • HTML Syntax: NOT allowed



« July 2016