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.
If you invoke Run or Run File on a j2seproject during CP scanning, a dialog will pop up and you will be forced to wait until scanning is complete before the Ant target is run - even though Ant is not using the result. The only reason is that in the unlikely event you were trying to run a class with no main method, the IDE could warn you in a dialog instead of showing NCDFE in the Ant console. This is certainly not a good enough reason to interrupt the user's work.
It is according to UI spec, the run has to check if the started class has a main method and if not it has to offer list of possible main classes. It behaves in this way from the time of NB 4.0. If the UI spec changes I am open to remove the check from J2SEActionProvider.
I know it is in the UI spec; the UI spec forces a behavior which is silly and interferes with day-to-day usage of the IDE. It has been a problem since NB 4.0. Try making a j2seproject with thousands of sources, some of them with main methods. Now open one of these classes in the editor, make some trivial change, and press S-F6. The saving of the file triggers a CP rescan which takes several seconds before the file is run, when this scanning could have been done perfectly well in the background. I did not suggest removing the check that the class has a main method - just to skip the check in case CP scanning is currently running, and only do it when it would cost nothing.
OK, sorry I've misunderstood the issue, I've thought that you meant not to do the check at all. In this case it's fine (no UI change is needed). I will do it to NB 6.0
I've tried this but the IDE is so busy with the scan (IO load during indexing rt.jar) that the project is started after the scan finished.
In the test case I use, rt.jar has already been indexed, it is the project which is being rescanned. Make a huge j2seproject with a main class (e.g. prep script in issue #104508), wait for scan to finish, run - fine. Now make some trivial edit to the main class, and press F6 without saving first. Rather than immediately running, the IDE sits there for a couple seconds and pops up a "scanning, please wait" dialog.
Later
Someone recently suggested a different fix for this problem, which also works nicely when build.xml has been customized to select a main class in an unexpected way: don't do any check before running at all, but install an AntLogger which notices if NoClassDefFoundError is thrown on the supposed main class when the program runs. If this happens, bring up the dialog and offer to pick a different main class. This makes the dialog helpful rather than intrusive, and ensures it is not displayed just because the Java infrastructure is having difficulty keeping up with reality.
NetBeans.org Migration: changing resolution from LATER to WONTFIX
Reopening because of invalid status.
It was fixed in NB 6.8 (for COS disabled). Change set 3655e3539716