简体   繁体   English

Eclipse 3,6(Helios)引用的项目具有主要方法,在以引用的项目为目标时无法从运行配置访问

[英]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 1), the other contains some code specific to a task (project 2) and utilizes some classes and implements interfaces from the fancy app. 我在工作区中有两个项目,一个是由xml配置的高级应用程序(项目1),另一个包含一些特定于任务的代码(项目2),并利用某些类并从该高级应用程序实现接口。

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. 项目1包含main方法,并且由xml文件配置为使用反射从项目2加载类,因此需要从项目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. 项目2在构建路径中引用了项目1,因此没有显示任何错误和编译,但是从运行配置对话框中选择时,它没有显示带有项目1中的main方法作为选项的类。

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. 我现在的工作是从项目1生成一个jar,并从项目2引用它,然后使该类出现。 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. 这行得通,但是我讨厌每次在项目1中发生更改时都必须将项目导出到jar中。我也不想让EXACT相同的类以开放类型显示两次,一次来自jar,一次来自项目。

Is there something on top of adding the project to the build path I have to do to get this working? 除了将项目添加到构建路径之外,还需要做些什么才能使它正常工作?

Thanks 谢谢

您可以从项目1启动应用程序,只需要编辑其启动配置并在Classpath选项卡上添加项目2。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM