Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 318574 - Run Configuration > Main > Main class: uses first (wrong) class
Summary: Run Configuration > Main > Main class: uses first (wrong) class
Status: RESOLVED WORKSFORME
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Debug (show other bugs)
Version: 3.7   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: JDT-Debug-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-07-01 05:56 EDT by MH CLA
Modified: 2012-11-20 15:50 EST (History)
2 users (show)

See Also:


Attachments
2 launch configurations (2.29 KB, application/zip)
2010-07-06 03:52 EDT, MH CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description MH CLA 2010-07-01 05:56:40 EDT
Build Identifier: 20100617-1415

I know this is a special case, but anyway, I consider this a bug. As we still have to use old VSS (6) as source control and "forked" a project for antoher (older) system in VSS, we now have to separate Java projects but with almost the same content, especially the same package names and class names.

When I create a new Run Configuration (Java Application), I can setup a different name, different paths, etc. But in the "Main" tab, section "Main class:" I can just select from the existing classes or type in the class with its package name. When I run this configuration, I get exceptions during runtime as it used the main class from the other (!) project (that already evolved and has a different implementation and interfaces).

The "Main class:" field/browser should enforce showing just classes in the selected project (field "Project:" above)!

A workaround I found so far: when I close the other project (with the same class name), it works.

Reproducible: Always

Steps to Reproduce:
1. create 2 Java projects with the same package and class names.
2. create 2 run configurations "Java Application" and choose a "Main class" that exists in both projects.
3. both run configurations use the class of (this first saved/the first in the list/?) just one project.
Comment 1 Frederic Fusier CLA 2010-07-01 08:12:11 EDT
I cannot reproduce using 3.6.0 build (I20100608-0911).

Are you sure that the project of each launch configuration is correct, i.e. project A for the first launch config and project B for the second one?

How did you create the second launch config? Maybe by duplicating the first one... If so, don't you forget to change the project in the 'Project' field above the 'Main class' field in the 'Main' tab of the copied launch config?
Comment 2 Olivier Thomann CLA 2010-07-01 09:31:32 EDT
Move to JDT/Debug
Comment 3 MH CLA 2010-07-01 15:47:24 EDT
Yes, I copied the first one, but went through EVERY accessible setting and checked/adjusted to the new project/path! (Before I did this, I wasn't even able to start the application.) Of course I also changed the project, classpaths, working directory, ... etc.
Comment 4 Michael Rennie CLA 2010-07-05 09:35:44 EDT
can you attach the launch configurations in question?
Comment 5 MH CLA 2010-07-06 03:52:16 EDT
Created attachment 173507 [details]
2 launch configurations

As requested: the two launch configurations.
Comment 6 Michael Rennie CLA 2010-07-13 09:58:12 EDT
Using the steps from comment #0 I cannot reproduce either. Looking over the attached launch configurations I do not see any discrepancies.

What happens if you recreate the two launch configurations without doing any duplication?
Comment 7 Michael Rennie CLA 2012-11-20 15:50:52 EST
Closing worksforme