如何从Eclipse中的另一个项目调用一个类? [英] How to call a class from another project in Eclipse?

查看:772
本文介绍了如何从Eclipse中的另一个项目调用一个类?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Eclipse,我有两个不同的项目:A和B。

I'm using Eclipse and I have two different projects: A and B.

项目A 中,我有一个类 classA 我需要从类 classB methodB() $ c>包含在项目B 中,我该怎么做?

In project A, I have a class classA where I need to call a method methodB() from a class classB contained in the project B, how can I do that?

我尝试将项目B添加到项目A的构建路径,但仍然不起作用。

I've tried adding the project B to project A build path, but still doesn't work.

谢谢。

推荐答案

您需要在项目选项卡中添加另一个项目,或者在库选项卡中添加项目的类文件夹ie您可以尝试将项目B添加到项目A使用的运行配置。转到菜单运行 - >运行配置,您可以在运行配置的classpath选项卡中添加项目B.

You need to add another project in "Project" tab, or add class folder of the project in "Libraries" tab ie you may try to add project B to the Run configuration used by project A. Go to the menu Run -> Run configurations, ther you can add the project B in the tab 'classpath' of your run configuration.

这篇关于如何从Eclipse中的另一个项目调用一个类?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆