X

Geertjan's Blog

  • April 17, 2011

Customizing the NetBeans Platform Installer

Geertjan Wielenga
Product Manager
I've seen lots of questions and discussions recently about how to configure the installer generated by NetBeans IDE for NetBeans Platform applications. Rather than digging through build scripts and tweaking them, I think it makes more sense to go into the templates within the 'harness' folder of your platform and then... to tweak the files you find there.

For example, getting from this default installer...

...to this one (notice a different icon in the top left, a different text with a different font color, and a significantly smaller size)...

...is really trivial. Go to your platform's harness folder (e.g., if you're building on the 'default' NetBeans Platform, that means that you should go to your installation of NetBeans IDE and then into the 'harness' folder that you find there).

Once you're there, go into the 'nbi' (i.e., "NetBeans Installer") folder and do searches for the icons and strings that you'd like to replace. You might even want to look for the wizard classes that define the installer wizard and you could change those as well:

In other words, I reckon the best solution is to customize those templates, run the "Package as | Installers" menu item, and then see what you'd like to change. Then go back and customize those templates some more. Until you have what you'd like. I'm planning to experiment some more with this, including changing the code in the templates themselves (which are actually NetBeans projects, so that's an interesting thing too), to see how far one can get.

Note: A disadvantage to this approach is if you're creating multiple application on your platform, i.e., the harness is shared between multiple applications. In that case, you'll need to configure, within each application, your usage of the harness/nbi folder. Or, an alternative might be to use different harness/nbi folders for different applications, i.e., copy in a different harness/nbi folder when you create a new installer, which could even be automated via an Ant script.

Any specific areas anyone would like to customize? Try and see how far you get and then blog about it. Curious to know if there's anything that can't be modified in this way.

Join the discussion

Comments ( 24 )
  • Ernest Sunday, April 17, 2011

    One of the most interesting things to me that I've been unable to do so far with the NBI infrastructure is to bundle a JDK with the installer. This will be very useful especially with regards to new NBP applications that will roll out in coming months that will depend on JDK7 - in such a case the assumption that JDK7 is already pre-installed on the target machine will not necessarily hold.

    Has anyone done this, and willing to write up a nice step-by-step set of instructions?

    Geertjan, especially interesting from your post is that these installers are just NetBeans projects - if it is easy to manage different copies for different applications (we are developing more than one) then this is a powerful tool indeed!


  • Tim Sparg Monday, April 18, 2011
  • Eduard Monday, April 18, 2011

    this installer is a nice feature i will like to be able to use on some other proyects outside applications that use NetBeans Platform.


  • rov63rus Thursday, April 21, 2011

    NSIS is good! But the most of NBP developers wish to have installer out-of-the-box. I think it could be one of the fundamental benefits of using NBP. More proffesional integrated decisions from out-of-the-box more community!

    Blog is amazing! Thanks to Geertjan for great job!


  • Eduard Friday, April 22, 2011

    NSIS is a good installer system, but it has become deprecated, lack of 64 bit support.

    lack of UAC support (supports but just the basic no elevation is posible without a external module)

    no system independent it will not work on linux(native) and does not provide a compiler for others systems.


  • guest Friday, June 3, 2011
    This is great article! But I wanted little bit more. I want to package the derby database (instance) folder also with the installer. By default when you create Package as -> Installers, it does not include the database instance.
    In my project I have pre-configured the database with all the data. I am using embedded derby database and I wanted this also to get packaged so that user get the instance of the database and start using the data.
    Any option in Netbeans Installers to achieve this?
  • guest Friday, June 3, 2011
    This is great article! But I wanted little bit more. I want to package the derby database (instance) folder also with the installer. By default when you create Package as -> Installers, it does not include the database instance.
    In my project I have pre-configured the database with all the data. I am using embedded derby database and I wanted this also to get packaged so that user get the instance of the database and start using the data.
    Any option in Netbeans Installers to achieve this?
  • guest Sunday, June 26, 2011

    @Ernest, @guest

    This may not be the most elegant. But it works. You can have the installer bundle anything you want. Create a folder named "release" inside your project folder (e.g. "c:\Documents and Settings\My Documents\NetBeansProjects\MyProject\release"). Then, mirror the folder structure for where you want your pieces installed.

    If you look in the Project Properties file for your NetBeans application, you will see an entry for "app.name". Let's assume that it's set to "app.name=myproject"

    How I bundle a Derby database:

    ------------------------------

    I created the database in release\modules\ext\JavaDB. In the insalled product this database will be found in <install_root>\myproject\modules\ext\JavaDB

    How I bundle a JRE:

    -------------------

    I provide my own configuration file, as per this Geertjan post http://blogs.oracle.com/geertjan/entry/support_for_custom_configuration_files (e.g. myproject.conf)

    In myproject.conf I then include the following lines

    # default location of JDK/JRE, can be overridden by using --jdkhome <dir> switch

    jdkhome="myproject\modules\ext\jre"

    Finally, I put a jre in release\modules\ext\jre. In the insalled product this database will be found in <install_root>\myproject\modules\ext\jre, as pointed to by myproject.conf which will be found in <install_root>\etc\myproject.conf

    This all works great. However, when generating the installers it will take several minutes trying to process the jre and will spit out lots of security violations about not being allowed to add code to java package. I don't really understand what exactly the installer is doing during that process. But, the end result is a fully functional jre where you expect it to be.

    Hope that helps.


  • guest Tuesday, July 12, 2011

    hi......

    i m working on netbeans platform application....

    i want to design a login window but dont wanna use notifier descriptor..

    i wanna use topcomponent(window)....

    it should be opened at application's startup that the thing i have done,bur after a successfull login the entry of this login window which is in file menu must be disabled which i dont know how to do this....

    please help me asap.............


  • Geertjan Tuesday, July 12, 2011

    Join/Write to the mailing list with your questions: dev @ platform netbeans org


  • Ernest Wednesday, October 26, 2011

    Just to recursively get back to this post, in case someone finds this without some clear answers, http://netbeans.dzone.com/including-jre-in-nbi may be very useful.


  • guest Friday, December 16, 2011

    We have Maven-based NetBeans Module project. We could build installer without any issues, but now we need to be able to build multiple installers for differnt env:Test, Dev,PROD. Every time when you create an installer and try to install it detects that this application has been installed and is trying to uninstall it, even so it has different names. We need to KEEP all versions of application to be installed on the same computer. How to do that? Thanks in advance!


  • Basanta Thapa Thursday, January 19, 2012

    I was wondering how to customize installer related things, but this is a

    definite good startup for me. In addition if you can provide information like

    entering serial key during installation and checking for the serial key by the

    application on every start of the program, it will be highly appreciated. Java

    is built on the concept of write once, run anywhere but despite this, any

    commercial desktop application developed must be restricted for piracy and

    serial key will be the only option.

    Thank you once again for the nice article. In the anticipation of a quick

    reply.


  • Tibus_29 Wednesday, June 6, 2012

    Hi all,

    How can I customize the installation process ? For example, add some specifics libraries to java.librairy.path...

    Thanks


  • guest Friday, May 31, 2013

    Hello guys. Ernest, could this be used to copy any folder during the installation process to the root directory of the application installation folder(e.g. C:\\Program Files\<application name>?

    I am a student in Computer Information Science and I was working on a project in creating a platform application using Netbeans 7.3. What happened was that I used some pictures in the application but when packaging the application as an installer, those folders are not included so when I install it on a computer it doesn't show my pictures in the application, only if I copy the folder with the pictures to the installation folder manually.

    I wanted to know if it was possible to include this automatically when building the installer. Looking at your response to guest. I really wanted some help with this. I've been struggling with this for almost a month now. I appreciate any help.


  • Geertjan Friday, May 31, 2013

    The answer is "Yes" and here's the tutorial:

    https://platform.netbeans.org/tutorials/nbm-nbi.html


  • Winnifred Sunday, June 2, 2013

    Hey, it worked for me.

    I tried Ernest's first response at first and I didn't realised that it worked since it didn't exactly copy the files to the expected folder, but to a subfolder of that folder. When following Geertjan's example in the link I realised this was what happened, so the problem was solved from Ernest's example already. Thank you guys for sharing these posts and answering some of these questions that we have.


  • guest Wednesday, December 4, 2013

    Is this recommendation for real? Changing something in the NetBeans install directory doesn't seem like the way to go. I see many problems with this approach:

    1. Next time you update NetBeans IDE your changes are lost

    2. In corporate environments users will typically not have write access to "C:\Program Files" or "C:\Program Files (X86)".

    3. Customization done this way will apply to *all* your RCP projects. You'll probably want to customize things like icons and installer text on a per-project basis.

    4. You can forget about Maven-based projects. The recipe given in this blog works for Ant-based projects only. For Maven-based projects the Harness from the NB Install Dir is not used, instead the Harness is downloaded in a module and will essentially live in your local Maven repo. You can of coure - following the same rationale as given in this blog - customize the Harness found in your local Maven repo (typically $HOME/.m2) but that will work only until the local repo gets updated.

    Don't get me the wrong way: I'm glad that someones takes time to blog about this. The proposed solution just doens't seem 'right' to me.


  • Geertjan Wednesday, December 4, 2013

    Yup, many problems, but the only way to go.


  • guest Monday, February 24, 2014

    Hi,

    I have created a netbeans application when i run or install the application the application name is attached with some nos like abc201310111528 so i want to remove those nos .Please help me how to resolve this issue.


  • Keyur Shah Tuesday, August 12, 2014

    I want to customize a installation wizard. In default scenario, if installation wizard finds that application is already installed, it gives an option to "Exit" only. How can I add an another option which allows uninstallation of application and then continue installation? Is it possible?


  • guest Wednesday, May 27, 2015

    I want to use sigar.jar library to find the cpu details ,but when i create installer and run, it throws SigarException class not found, i think i am not able to place sigar.jar in right place, culd you please suggest how to use external jar to customize netbeans plateform installer, it will really help me to

    achieve my goal


  • Les Tuesday, November 8, 2016

    Thanks as always, Geertjan, for being such a valuable resource. Your posts are always useful and often inspiring.

    Like others here, I think the ability to create installers out of the box is one of the best features of NetBeans RCP. However, I am running into some strange problems. I build the installers on Window right in the IDE but on Linux, the installer builds an application that has many of its paths with NO PRIVILEGES whatever. An ls -l will reveal all dashes (no one has read, write, execute, etc). How can this have happened? I see similar results from Mac OS X.


  • Les Foster Monday, November 21, 2016

    I have at long last figured out the problem of which I posted back on November 7. I have learned that the installer looks at the installer-build (your development) system's file settings to figure out how to set them up on the target (where a user is installing the finished app) system.

    To do so, the "nbi" system first attempts to leverage the "ls" command. If it finds one, it saves the reported permission settings of the files that will be restored to the downloading system upon installation. If the nbi system does not find an "ls" command, it will instead rely on default or overridden property settings for permissions.

    On my development system, I had a very old version of "cygwin", and the "ls" command ('ls -ld' to be exact) was reporting 0 for permissions, and that is what got saved to the installation. Of course, with 0 permissions (no read, no write, no execute/chdir), the application instantly fails when you try and launch it.

    The solution to this, therefore is either remove the offending "ls" command from the PATH, or make sure it reports usable permissions. I hope that helps someone in future. I had to go to some lengths to learn how this works.


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

Integrated Cloud Applications & Platform Services