java 将一类不同的项目导入到我的项目中

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/12425960/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-31 08:50:30  来源:igfitidea点击:

Import a class of different project into my project

javaandroid

提问by Syamantak Basu

I have a demo project-named A having a class Class AA. and I have another demo project-named B having a class Class BB. My question is how can I import ClassBB in class AA??????

我有一个名为 A 的演示项目,具有 AA 类。我有另一个名为 B 的演示项目,它有一个 Class Class BB。我的问题是如何在 AA 类中导入 ClassBB????

回答by Kyriakos

What you have to do is to add project A to project B's build path. Check this thread if you are working with eclipse: import from another java project in eclipse

您要做的是将项目A添加到项目B的构建路径中。如果您正在使用 eclipse,请检查此线程: 从 eclipse 中的另一个 java 项目导入

right click on project b's folder in eclipse --> properties --> build path --> projects --> add.

右键单击eclipse中项目b的文件夹-->属性-->构建路径-->项目-->添加。

回答by Amit Deshpande

Add Project B in A's build Path. If you are using Eclipse. Right Click on Project->Java Build Paht->Projects->Add

在 A 的构建路径中添加项目 B。如果您使用的是 Eclipse。Right Click on Project->Java Build Paht->Projects->Add

回答by DayS

You have to define a dependency from you project A to project B.

您必须定义从项目 A 到项目 B 的依赖项。

In eclipse, make a right-click on project A and select "Propeties". Then, in "Java build Path", choose the "Project" tab. Click on the "Add" button and select project B. Validate, and you'll be able to import class BB in class AA

在 Eclipse 中,右键单击项目 A 并选择“属性”。然后,在“Java 构建路径”中,选择“项目”选项卡。点击“添加”按钮,选择项目B.验证,就可以在AA类中导入BB类了