如何在Eclipse / Java中的同一工作空间中引用另一个项目的类 [英] How can I refer to a class from another project in the same Workspace in Eclipse/Java

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

问题描述

我的Eclipse ADT Android / Java工作区中有两个项目

  MyProject 
MyProjectAutomatedUITests

在MyProject中,有一个包 .constants code> ButtonNames.java 这是充满常量的



我希望能够使用MyProjectAutomatedUITests



我该怎么做?

解决方案

您必须将 MyProject 添加到您的 MyProjectAutomatedUITests 通过右键单击项目而不是属性>构建路径>项目>添加并选择您的项目,通过这样做可以使用 MyProject 的类。



但是,如果你只想要一个类,你应该创建另一个类你的ptoject。


I have two projects in my Eclipse ADT Android/Java workspace

MyProject
MyProjectAutomatedUITests

In MyProject, there is a package .constants with a class ButtonNames.java that is full of constants

I want to be able to use the members of that class from MyProjectAutomatedUITests

How can I do that?

解决方案

You have to add your MyProject to the build path of your MyProjectAutomatedUITests by right clicking the project than Properties>Build Path>Projects>Add and select your project, by doing this you can use the classes of MyProject.

But if you just want only one class than you should create another one for your ptoject.

这篇关于如何在Eclipse / Java中的同一工作空间中引用另一个项目的类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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