Customizing the NetBeans Platform Installer

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.

Comments:

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!

Posted by Ernest on April 17, 2011 at 05:49 AM PDT #

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

Posted by Eduard on April 17, 2011 at 11:17 PM PDT #

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!

Posted by rov63rus on April 21, 2011 at 02:12 AM PDT #

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.

Posted by Eduard on April 22, 2011 at 01:33 AM PDT #

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?

Posted by guest on June 02, 2011 at 11:07 PM PDT #

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?

Posted by guest on June 02, 2011 at 11:18 PM PDT #

@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.

Posted by guest on June 26, 2011 at 07:02 AM PDT #

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.............

Posted by guest on July 11, 2011 at 09:01 PM PDT #

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

Posted by Geertjan on July 11, 2011 at 09:06 PM PDT #

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.

Posted by Ernest on October 26, 2011 at 03:58 PM PDT #

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!

Posted by guest on December 16, 2011 at 08:55 AM PST #

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.

Posted by Basanta Thapa on January 18, 2012 at 07:53 PM PST #

Hi all,

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

Thanks

Posted by Tibus_29 on June 06, 2012 at 07:00 AM PDT #

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.

Posted by guest on May 31, 2013 at 11:14 AM PDT #

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

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

Posted by Geertjan on May 31, 2013 at 02:26 PM PDT #

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.

Posted by Winnifred on June 02, 2013 at 03:48 PM PDT #

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.

Posted by guest on December 04, 2013 at 02:46 PM PST #

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

Posted by Geertjan on December 04, 2013 at 03:45 PM PST #

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.

Posted by guest on February 24, 2014 at 05:23 AM PST #

Post a Comment:
  • HTML Syntax: NOT allowed
About

Geertjan Wielenga (@geertjanw) is a Principal Product Manager in the Oracle Developer Tools group living & working in Amsterdam. He is a Java technology enthusiast, evangelist, trainer, speaker, and writer. He blogs here daily.

The focus of this blog is mostly on NetBeans (a development tool primarily for Java programmers), with an occasional reference to NetBeans, and sometimes diverging to topics relating to NetBeans. And then there are days when NetBeans is mentioned, just for a change.

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
12
13
14
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today