Community
Participate
Working Groups
If I select the default package and do "Run As->Java application" I get the message that "the selection does not contain a main type" even if there is a class in the default package that has a main type. If I select the whole project I get a list with many classes, but the class in the default package does not appear there. Is it a regression from earlier builds? I don't remember that it was not working before.
This works for me on RC4, which build are you using?
OK, I found it does not work for a simple project layout with *no* source folder. If I create a project 'P' with a main type 'A' in the top level folder, the main type is not found. If I create a 'src' folder that contains the top level type 'A', then it works.
This did work properly in M6 - not sure when it got broken.
Moving to JCORE for comment. It appears we set up a search scope for main methods and perform the search in the default package, getting no results when the project has a simple setup (i.e. source and binaries in the root folder). However, the search works when there is a top level source folder, and separate output folder. To step thru our code that performs the search. Place a breakpoint in MainMethodSearchEngine.searchMainMethods(IProgressMonitor pm, IJavaSearchScope scope, boolean includeSubtypes), and invoke the "Run As > Java Application" on a default package.
You're right, I don't have a source folder defined. I have two questions irrelevant to this bug: 1. why by default the projects are creating without separate source folders? 2. can MainMethodSearchEngine be made an API? There are already two implementations of this class and I needed a similar functionality to implement the launcher in my RMI Plugin. Thanks, Genady
Created attachment 24130 [details] Improved JavaSearchScope
Created attachment 24131 [details] Regression tests
*** Bug 101602 has been marked as a duplicate of this bug. ***
Released fix from comment 6 and tests from comment 7 were improved and moved to a new class JavaSearchScopeTests by Frederic.
Verified in I20050920-0010 for 3.2M2