taT | Passing Arguments Using IDE


I’m back with yet another tip, its time to get back to the basics, and explore them using NetBeans IDE.

Note –
Before I begin, I would like to mention, that recently, Sun distributed 100 NetBeans IDE Tips & Tricks Mini-Book at NetBeans Day! Adam Myatt, had announced it on NetBeans Dzone and listed title’s of all the Tips & Tricks! So, I was not sure whether Tip 31, is similar to the one I’m mentioning or not!

So, I’m assuming that what I’m going to mention is unique as per my knowledge…lets get it started then 🙂

When there were no IDE’s, all of us, would depend on CLI (Command Line Interface), to run and test our programs! You might have set the CLASSPATH, to run your Java programs from the working directory! Then, we use to pass runtime arguments to programs, to do the necessary work.

Introduction –

Now, when we have IDE’s, I would rather like to master the IDE and do everything possible to create efficient applications, than go on CLI and waste my time.

However, sometimes I feel that one should be accustomed to work on the CLI as well, as these are the basics, until and unless your basics are strong, you can’t go into the depth of a particular domain!

Problem Description –

So, I thought of making use of runtime arguments through the IDE, is it possible! Well, any new NetBeans User would be surprised to know, that its possible…

Solution –

NetBeans 6.0, 6.1 provide a way, but this no longer serves the purpose of sending the arguments dynamically, i.e. you have to set pre-defined arguments before running the program…

Have a look at the screenshots;

Fig 1. Right-click the Project Node, select the appropriate menu-item to goto Project Configuration Window.

Fig 2. Click on Run, as you can see, then see to its right there’s a label ‘Arguments’, select the text-box next to it.

Fig 3. Now, enter arguments, I tried using “Hello” and “World”, space has to be there for separating arguments as you would do in a CLI.

Fig 4. Edit Main.java, to see whether your application prints the arguments in Output Window.

Fig 5. Well, it does! See the Output Window.

Similarly, you can do it for NetBeans 6.1 Beta, Release Candidate 1, 2 and NetBeans 6.1 FCS!

Anyways, try this out and do let me know, whether its helpful OR not!

This is being submitted for review to the blogging contest – Student Reviews NetBeans 6.1 and OpenSolaris!
Author – Varun Nischal, University – JIIT University

Add to Technorati Favorites

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


2 thoughts on “taT | Passing Arguments Using IDE

  1. After Submission, this is what Sun says –
    Thank you

    We at Sun appreciate your form submission.
    Your information will be forwarded to the appropriate person or department.

    Thanks for your interest in Sun Student Reviews.

    Thanks again,
    Sun Microsystems, Inc.

    So, when are you going to review, time is running out!

  2. Pingback: Submissions | Student Reviews Contest « NetBeans Guru

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 )

Google+ photo

You are commenting using your Google+ 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 )


Connecting to %s