Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 252074

Summary: "Selection does not contain a main type" error from project that has been added to a second projects libraries
Product: [Eclipse Project] JDT Reporter: Alan Haggarty <haggarty>
Component: DebugAssignee: JDT-Debug-Inbox <jdt-debug-inbox>
Status: CLOSED WONTFIX QA Contact:
Severity: normal    
Priority: P3 CC: darin.eclipse, rashraf
Version: 3.4.1   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard: stalebug
Attachments:
Description Flags
screen shot of config for test2 class none

Description Alan Haggarty CLA 2008-10-24 17:41:59 EDT
Build ID: M20080911-1700

Steps To Reproduce:
1. Create a java project test1
2. In test1 create a simple class with a main method
3. Create a java project test2
4. In test2 Properties >> Java Build Path >> Libraries tab add test1 using "Add Class Folder"
5. Try to run the class created in test1

Result is an error "Selection does not contain a main type" for a class that executed correctly before test2 was created and configured.

More information:
Comment 1 Jerome Lanneluc CLA 2008-10-31 06:26:10 EDT
Moving to JDT/Debug
Comment 2 Darin Wright CLA 2008-10-31 10:59:24 EDT
Works for me. I added the "test1/bin" folder as the class folder to "test2", expand the folder, select "class1.class", press "Run" and it works.
Comment 3 Darin Wright CLA 2008-11-04 10:42:04 EST
Marking as works for me.
Comment 4 Alan Haggarty CLA 2008-11-05 15:06:42 EST
Created attachment 117136 [details]
screen shot of config for test2 class
Comment 5 Alan Haggarty CLA 2008-11-05 15:07:43 EST
I also cannot reproduce if I add test1/bin, but if I add just the top level test1 it does. See the attached screenshot for build path config of test2.
Comment 6 Darin Wright CLA 2008-11-05 15:15:53 EST
Is this valid. What is the output directory for project test1? (is it the root of the project?) When specifying a class folder you have to specify the root of the packages.
Comment 7 Alan Haggarty CLA 2008-11-05 15:59:11 EST
I am not sure, I have been able to resolve dependencies in a second project this way if I try to instantiate class1 from test2/class2 for example, so it can find the classes. It just includes bin.test1.

I looked back at the original test and in that case the projects do not have separate directories for class and src files (Uses "Use project folder as root for sources and class files") and in that case there is no option to add bin directly.

Also in that case removing the directory from the library path of test2 doesn't fix the problem in test1. It seems to be permanently unrunnable. 
Comment 8 Eclipse Genie CLA 2020-01-17 05:24:58 EST
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. As such, we're closing this bug.

If you have further information on the current state of the bug, please add it and reopen this bug. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.