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 201308 - Simpler UI for running main classes with various params and sysprops
Summary: Simpler UI for running main classes with various params and sysprops
Status: RESOLVED WONTFIX
Alias: None
Product: projects
Classification: Unclassified
Component: Maven (show other bugs)
Version: 7.0.1
Hardware: All All
: P3 normal (vote)
Assignee: Tomas Stupka
URL:
Keywords: UI
Depends on:
Blocks:
 
Reported: 2011-08-25 07:19 UTC by tomzi
Modified: 2016-07-07 08:39 UTC (History)
0 users

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description tomzi 2011-08-25 07:19:40 UTC
This is currently a pain in the ass!

While just running the main file is fairly simple most classes with a main() method usually have arguments to be passed to and/or System properties to be set to.

And this is currently far from obvious. In my opinion there should be 
.) one simple straight forward place to add a line of arguements and -D parameters for a single main() Class
.) or some 'Create Run Configuration' wizard for a single file. Which I could also use for debugging and profiling
.) There should by the possiblity that every time I run 'Run file' a dialog should pop up (which eg eclipse conveniently supports) asking me for some arguments to enter. E.g: I start the single file, a popup appears asking for argument 'arg3' and 'arg5' and then starts the single file with arg1, arg2, arg4 preconfigured and arg3,arg5 asked for every time. Arg3, Arg4 could even have some preconfigured default value.
.) NB should know the correct Run Configuration('s) for each file I created it/them for. So I should not have to change run configuration (per default) if I start file1, file2, file3 which each have different Run Configurations.

However at the moment this is very complicated to achieve, since
.) First you (as NB user) have to understand that you have to create one 'configuration' per file, if I want to have different arguments for different 'main()' files, which is not obvious from the 'Actions' Dialogue.

.) Then you have to find out what I have to do to pass arguments to my 'Run file'. My first approach was to just add several lines with arguments to the 'Set Properties' field -> FAILED. Only after some other failed approaches and after I googled for the correct way I added the arguments to 'exec.args'.

However I still don't know where I should add my '-D' parameters so that I can read these from within the main() as System.getProperty(...) -> Can you give me a hint?!

.) Then finally I have to first select a 'Run configuration' and I still have to select a file to run it with, for another file I have to select another configuration first. This is IMHO not sth I should have to do everytime. NB should just remember which Run configuration to take for which 'Run File' or If I select a Run Configuration it should remember which 'Run file' to take -> Just makes it a lot easier.
Comment 1 Jesse Glick 2011-08-25 17:03:06 UTC
Not entirely specific to Maven projects since there is a similar UI for j2seproject's - each configuration may define a main class and associated configuration (VM params, arguments, etc.). In fact if you ignore the Actions panel and just focus on the Run panel, the UI and behavior is almost the same.

By the way my original UI for configurations included a dropdown box next to the Run [Main] Project toolbar button with a list of configurations you could apply just for that run (rather than first switching config and then running), but this was removed somewhere along the line.

(In reply to comment #0)
> Which I could also use for debugging and profiling

It is unfortunate that the current system does not automatically carry over run information for debugging & profiling. But the Run panel does copy the run action's configuration to debug and profile in nbactions.xml.

May be fixable, though compatibility with existing nbactions.xml is always a concern. Would perhaps need some way of defining <properties> inside <actions> which could be substituted in any individual <action>.

> There should by the possiblity that every time I run 'Run file' a dialog
> should pop up asking me for some arguments to enter.

Probably possible using a special execution checker and a magic $INPUT string somewhere in the parameters.

> I still don't know where I should add my '-D' parameters so that I can
> read these from within the main() as System.getProperty(...)

-Dk=v may be added to exec.args (before the main class). Equivalently and more easily, add it to VM Options in the Run panel.

> Then finally I have to first select a 'Run configuration' and I still have
> to select a file to run it with

Not true. Just press Run Project. There is no need to navigate to the main class.

In fact Run File ignores any configuration for Run Project; they are separate actions. (Generally you would not customize Run File in a configuration, though there is nothing preventing you from doing so. The Run panel only customizes the Run Project action.)
Comment 2 Martin Balin 2016-07-07 08:39:40 UTC
This old bug may not be relevant anymore. If you can still reproduce it in 8.2 development builds please reopen this issue.

Thanks for your cooperation,
NetBeans IDE 8.2 Release Boss