X
  • May 31, 2010

Support for Custom Configuration Files in NetBeans Platform 6.9

Geertjan Wielenga
Product Manager
"netbeans.conf" is a file most NetBeans IDE users know about, since that's where the IDE's user directory and JVM arguments are defined. The same is true for any application created on top of the NetBeans Platform, i.e., each application has its own configuration file.

When you choose "Build ZIP Distribution" in the IDE, or if you run the related Ant target on the command line, the default configuration file from "harness/etc/app.conf" is added to the ZIP distribution of your application. However, what if you don't like that default configuration file? I.e., you have your own custom configuration file, how do you get that into your product distribution? Since everything is built on Ant, it's a question of creating an Ant target that copies in the appropriate configuration file.

However, from 6.9 onwards, there's a new property that you can set, pointing to the configuration file you'd like to replace the default configuration file. Then, when the ZIP target is run, your own configuration file is used instead of the default.

app.conf=nbproject/my.conf

I've set the above in the application's "project.properties" file. The "my.conf" contains a copy of the default configuration, together with some customizations. Now when I run the ZIP target, my own configuration file is included, using, as the name of the "conf" file, the branding name, which is set as follows in the same "project.properties" file:

app.name=taekwondoapp
branding.token=${app.name}

Here's the related change: http://hg.netbeans.org/main-golden/rev/9f10d5cbc0aa

Pretty handy improvement.

Join the discussion

Comments ( 14 )
  • Alied Pérez Friday, June 4, 2010

    Hi Geertjan, does it work as well for the installer, I guess...?


  • Mathieu Thursday, August 19, 2010

    That's nice, I was looking for this. Thanks!


  • Tom van Gorkom Wednesday, October 13, 2010

    Hi Geertjan, how is this done when using maven?


  • Jesse Glick Wednesday, October 13, 2010
  • pankaj tripathi Tuesday, January 4, 2011

    hello Geertjan

    we have developed an application on NetBeans Platform .we have used JVM Switches in application's build.launcher.etc.CONF file,increases Heap Size and removed unwanted modules in our application,to reduce StartUp Time.

    now my applications start-up time is 4.5 seconds.

    can u suggest me how much we can reduce start up time.

    we need 1-2 seconds.

    tell me the ways...


  • Geertjan Wielenga Tuesday, January 4, 2011

    Hi Pankaj. You have not provided any meaningful information. How on earth am I meant to guess how you're supposed to improve performance? It's the same as me saying: "My car needs to go faster. What should I do?" Well, that depends on 1000000 things. Join the mailing list dev @ platform . netbeans . org and ask your question there -- but I hope you'll provide some meaningful information.


  • pankaj tripathi Wednesday, January 5, 2011

    hello sir ,

    i have joined NetBeans Forum.

    (http://forums.netbeans.org/ptopic23854.html ).

    i have posted my query (topic--"how to reduce startup time of Netbeans Platform Application"

    on NetBeans Platform Users .my Id is blog@pankaj

    )

    but no one replied.

    plz just see that,and reply because i have to submit my project as soon as possible.

    further i ask question there. very sorry for this time for posting here .

    pankaj


  • Geertjan Wielenga Wednesday, January 5, 2011

    How can I help you? I have no idea at all about what your application is doing. I still have no clue at all. How can anyone help you?


  • Tomislav Nakic-Alfirevic Monday, July 4, 2011

    Hi Geertjan, I've posted a question on stackoverflow about using a custom app.conf in a maven-built problem:

    http://stackoverflow.com/questions/6558551/where-should-a-custom-netbeans-platform-conf-file-be-so-that-maven-finds-it

    Could you shed some light on how to tell maven to package the custom file with the application?


  • Geertjan Monday, July 4, 2011

    Stop posting questions there, post them at dev@platform.netbeans.org instead, that's where the NetBeans Platform experts are found.


  • Tomislav Nakic-Alfirevic Monday, July 4, 2011

    You're right. In the meantime, however, I've found the answer (on your blog, in fact) and have documented it under my stackoverflow question.


  • guest Friday, June 1, 2012

    what about custom preferences (NbPreferences) that get lost after compile ? How can i preload them? After "Clean & Build" everything gets lost so i need to open my custom GUI* Tools->Options->My Settings-> ...and press OK so the code for store() method gets executed (NbPreference.forModule(xxx).put(thisOption))

    is there a way to have the same configuration file for Building & packaging ?

    *custom GUI created with OPtion Dialog API & SPI


  • Geertjan Friday, June 1, 2012

    Don't understand your question, but the best place to ask NetBeans Platform questions is on the mailing list: dev@platform.netbeans.org and not here.


  • Michael Bishop Friday, February 14, 2014

    I know this is an old article, but I just found use for it today. I also noticed something that I've not seen documented anywhere:

    If you build a ZIP distribution, any configuration file name works.

    If you build an installer, it appears your configuration file MUST be named the same as the branding token.

    In the example posted in this blog, the configuration file would have to be named taekwondoapp.conf to be picked up by the installer (I'm testing the Windows installer).

    I'm still on 7.3.1 so I don't know if this has been amended in later versions.


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