Support for Custom Configuration Files in NetBeans Platform 6.9

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

Comments:

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

Posted by Alied Pérez on June 04, 2010 at 12:28 AM PDT #

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

Posted by Mathieu on August 18, 2010 at 06:34 PM PDT #

Hi Geertjan, how is this done when using maven?

Posted by Tom van Gorkom on October 12, 2010 at 06:07 PM PDT #

@Tom: http://mojo.codehaus.org/nbm-maven-plugin/cluster-app-mojo.html#etcConfFile

Posted by Jesse Glick on October 13, 2010 at 12:58 AM PDT #

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

Posted by pankaj tripathi on January 03, 2011 at 10:29 PM PST #

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.

Posted by Geertjan Wielenga on January 03, 2011 at 10:35 PM PST #

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

Posted by pankaj tripathi on January 05, 2011 at 01:42 PM PST #

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?

Posted by Geertjan Wielenga on January 05, 2011 at 03:04 PM PST #

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?

Posted by Tomislav Nakic-Alfirevic on July 03, 2011 at 05:14 PM PDT #

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

Posted by Geertjan on July 03, 2011 at 06:50 PM PDT #

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.

Posted by Tomislav Nakic-Alfirevic on July 04, 2011 at 01:10 AM PDT #

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

Posted by guest on May 31, 2012 at 11:09 PM PDT #

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.

Posted by Geertjan on June 01, 2012 at 12:23 AM PDT #

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.

Posted by Michael Bishop on February 14, 2014 at 11:11 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
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today