Configure NetBeans using Batch Files..

Well, we all know that although editing “{netbeans.home}\etc”\netbeans.conf is not a big deal for any developer, it certainly takes a toll, if you’re using daily builds. That means, everytime you download new build of NetBeans you will modify the configuration file to tune JVM switches as per your operating system.

Last year, when I participated in NetCAT 6.5, I had this problem, i.e. I did the same configurations again and again, every time I downloaded latest build. Recently, when I downloaded 6.7 RC1 to make use of Kenai and Hudson integration, few days later I got the notification of 6.7 RC2 and related CA survey. Today, I downloaded that too, but it makes me feel sick to do those configurations all over again.

CLI (Command Line Interface)

There are people who write many scripts to ease their work by automating some tasks. As I was not good at using CLI, as I am right now. So, I thought of giving it a try and I looked into the internet to learn some batch programming. After exploring for some amount of time, I have written a batch program to help me with the task and here’s what I got;

for /d %%X in (%1\NetBeans*) do edit "%%X\etc\netbeans.conf"

Explanation

This batch program has got only the for-statement and this is where I look for NetBeans installation directories stored under the directory provided as a runtime argument denoted by %1 For instance, I have installed 6.7 RC1 and RC2 under C:\Program Files. So, I will make use of this batch program on CLI like this;

nbconfig "C:\Program Files"

Now, the batch program loops through this directory passed as a runtime argument and will look for the right installation directory by making use of NetBeans* as matching criteria. Once it finds the directories, it will loop each one of them, one-by-one and open the configuration file for editing.

Dis/Advantages

That’s the benefit that you just have to pass the directory (under which such directories could be found) and Windows will automatically open the configuration file for editing, if you feel its already edited before. Just perform action (Alt-F | Exit) to exit editor and to automatically switch over to the another configuration file.

There’s a limitation that if there are 10 installation directories under one directory (passed as runtime argument) and you have already made modifications to 6 of them, you will have to pass each one of them, before you could actually make modifications to the last 4.

Comments/Suggestions

You’re welcome to improve upon this and suggest changes to be made for benefit of the community. I think it won’t be difficult for Unix experts to write a shell script for the same, or probably come out with a better solution. Also, I have started to make use of Subversion using CLI (along with NetBeans support), interested readers can refer this blog for more info.

This blog has been contributed to NetBeans Community Docs Program and for latest updates on this content, refer to the contribution.

Hope that helps, stay tuned for more..

About these ads

One thought on “Configure NetBeans using Batch Files..

  1. Pingback: SVN, Batch Scripts and NetBeans Platform « PrayogShala

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s