When you run a Java project and no main class is set, the IDE displays a dialog offering to select from all the available main classes, so you can choose which one to run. It would be useful (especially for library projects), if I was able to also select a main class from a different project. In this case, for a library project I would select a main class from an application that uses this library.
More specifically, consider the following scenario:
1. I have the following projects open in the IDE:
App1, Lib1, App2, Lib2. App1 uses Lib1, and App2 uses Lib2.
2. I work simultaneously on Lib1 and Lib2, and switch between then. Depending on which one I am working on, I'd like to run either App1 or App2, to test my changes.
(but you could imagine many other similar scenarios.)
Currently this requires me to switch the main project all the time back and forth, so I can use the keyboard shortcut for running, debugging, testing, ... If I forget to change the main project, the IDE will run a different project than I intended.
If this enhancement was implemented, it would allow me to have NO main project set, and just work with the current project, and the IDE would behave in an intuitive and predictable way.
When selecting a main class in the project, you can also type a class on the project class path. It's not displayed as it's expensive but you can type it by hand.
It may solve your problem with switching the main projects.
(In reply to comment #1)
> When selecting a main class in the project, you can also type a class on the
> project class path.
Will not help in this case since e.g. app1.Main is not in the CP for lib1.
Can be worked around by overriding in lib1/build.xml:
<ant target="run" dir="../app1" inheritall="false"/>
Really just another use case of bug #166780.
*** This bug has been marked as a duplicate of bug 166780 ***
No longer a true duplicate. More like option #3 from bug #166780 comment #10.