Provide Runtime Arguments for Selected Class Files in NetBeans IDE 4.1
By Geertjan on Jun 19, 2005
<target name="-pre-init" description="Set Runtime Arguments"> <input message="Runtime arguments:" validargs="domsrc1.xml,domsrc2.xml,slide.xml,uddimsg.xml" addproperty="application.args"/> </target>
Next, you need to go to the Project Properties dialog box and delete whatever class is specified as the main class. This means that when you run the project, you're prompted to select a new main class. That's a bit inconvenient, but not too bad. So, when you run the project, you select the new 'main class' and then the -pre-init target above is called -- this asks you what runtime argument you'd like to use. (You can specify any acceptable arguments in the Ant target above, of course. If you want a blank slate rather than a pre-defined set of options, just don't define the validargs property in the target.) Then the run target is called and the application is run using the argument that you selected.
Note, however, that the above scenario only works when you run the application, not when you run a file. In other words, when you right-click a file and choose Run File, the application.args is set, but somehow (not sure why, but probably because it sets application-level arguments, not file-level arguments) not used in the target that runs the file. So, you have to right-click the project and then choose Run Project for the desired effect to occur.