I’m back with yet another tip, its time to get back to the basics, and explore them using NetBeans IDE.
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.
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…
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