This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 194372 - [70cat] When debugging an individual file, the arguments for the application are not passed.
Summary: [70cat] When debugging an individual file, the arguments for the application ...
Status: RESOLVED DUPLICATE of bug 174506
Alias: None
Product: java
Classification: Unclassified
Component: Project (show other bugs)
Version: 7.0
Hardware: All All
: P3 normal (vote)
Assignee: Tomas Zezula
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-01-14 22:33 UTC by esmithbss
Modified: 2011-01-17 09:12 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description esmithbss 2011-01-14 22:33:11 UTC
Product Version = NetBeans IDE Dev (Build 201101140000)
Operating System = Windows XP version 5.1 running on x86
Java; VM; Vendor = 1.6.0_22
Runtime = Java HotSpot(TM) Client VM 17.1-b03

When debugging a single file within an application, the debugger launches the file's main method; however, the program's arguments (from the project properties) are not provided.  The only way to get the arguments is to debug the Main Project or to debug the project as a whole.

The arguments need to be passed, regardless of how the debugger is invoking the code.
Comment 1 Martin Entlicher 2011-01-14 23:20:14 UTC
This needs to be implemented on the project level - the behavior is the same for Run and Debug,
Comment 2 Jesse Glick 2011-01-15 00:27:00 UTC
Program arguments are associated with a particular main class. When you run the project, that main class and those arguments are used. When you run an individual file, which will in general be a different main class (otherwise why wouldn't you just run the project?) and will in general take different kinds of arguments, none are passed.

If you have multiple main classes in your project and want to run them all at different times, create multiple run configurations. Each can have a main class, set of arguments, and some other information defined.
Comment 3 esmithbss 2011-01-15 22:46:07 UTC
This may be the way the system is designed to work, but of all the capabilities in NetBeans, this is the most non-obvious capability I have seen.  

Is there any documentation regarding this and how the Run File operation will require. Separate run configuration to get parameters passed into the file?

Also, if I choose to Run the File, how does this correspond with the run configuration selection in the toolbar?  If the correct run selection is not chosen, will it still find the right selection?

What if there are multiple run configurations assigned to a single main (quite possible),  will it use the run configuration selected in the combo-box?

This may be a situation where the fix is only additional documentation or hints to explain behavior, but there are some significant issues with working this capability (shown above) that need clarification.
Comment 4 Tomas Zezula 2011-01-17 09:12:11 UTC
Same as 174506

>Also, if I choose to Run the File, how does this correspond with the run configuration selection in the toolbar?
Not related at all. The configuration affects "run project".

>What if there are multiple run configurations assigned to a single main (quitepossible),  will it use the run configuration selected in the combo-box?
If there are multiple configurations in the combo box having the same class (or different class) the run project uses the active (selected) configuration.

*** This bug has been marked as a duplicate of bug 174506 ***