开发者

Eclipse 3,6 (Helios) referenced project has main method, cannot access from run config when targeting referencing project

I have two projects in a workspace, one is a fancy application that is configured by xml (project 开发者_JAVA技巧1), the other contains some code specific to a task (project 2) and utilizes some classes and implements interfaces from the fancy app.

Project 1 contains the main method and is configured by an xml file to load a class from project 2 using reflection, so it needs to be launched from the context of project 2.

Project 2 references project 1 in the build path, and thus shows no errors and compiles, however when selected from the run configurations dialog, it does not show the class with a main method from project 1 as an option.

My work around for now is to generate a jar from project 1 and reference that from project 2, which then causes the class to show up. This works, but I hate having to export the project to jar every time a change occurs in project 1. I also hate having the EXACT same Class show up in open type twice, once from the jar, once from the project.

Is there something on top of adding the project to the build path I have to do to get this working?

Thanks


You can launch your application from project 1, just need to edit its Launch Configuration and add a project 2 at the Classpath tab.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜