Redian新闻
>
Simple Question About Eclipse
avatar
Simple Question About Eclipse# Java - 爪哇娇娃
s*i
1
In eclipse, i have project 1, where i define 2 classes and make them both
belong to a package i define (eg: com.myPackage).
Then i create project 2, and i want to use those 2 classes from project 1.
It seems that i can accomplish this two ways:
1) Go to Java Build Path->Projects, add Project 1 as a "Required project"
for Project 2. And write "import com.myPackage.*" statement at the top of
Project 2's source code.
2) Go to Java Build Path->Libraries, click "Add Class Folder", and choose
the fo
avatar
k*r
2
i'd imagine method 1 would make project 1 a dependency of project 2
and will force compilation of project 1 when project 2 is compiled,
instead of just the a few classes in method 2.

【在 s*i 的大作中提到】
: In eclipse, i have project 1, where i define 2 classes and make them both
: belong to a package i define (eg: com.myPackage).
: Then i create project 2, and i want to use those 2 classes from project 1.
: It seems that i can accomplish this two ways:
: 1) Go to Java Build Path->Projects, add Project 1 as a "Required project"
: for Project 2. And write "import com.myPackage.*" statement at the top of
: Project 2's source code.
: 2) Go to Java Build Path->Libraries, click "Add Class Folder", and choose
: the fo

avatar
p*e
3
actually 1) is more standard than 2), use 1) you can make sure project 2
always get latest code from project 1 and you don't need to hard code
project 1 output directory in project 2 class path

【在 s*i 的大作中提到】
: In eclipse, i have project 1, where i define 2 classes and make them both
: belong to a package i define (eg: com.myPackage).
: Then i create project 2, and i want to use those 2 classes from project 1.
: It seems that i can accomplish this two ways:
: 1) Go to Java Build Path->Projects, add Project 1 as a "Required project"
: for Project 2. And write "import com.myPackage.*" statement at the top of
: Project 2's source code.
: 2) Go to Java Build Path->Libraries, click "Add Class Folder", and choose
: the fo

avatar
k*r
4
hmmm. i have never had to modify output directory in eclipse ...
Am I missing anything?

【在 p******e 的大作中提到】
: actually 1) is more standard than 2), use 1) you can make sure project 2
: always get latest code from project 1 and you don't need to hard code
: project 1 output directory in project 2 class path

avatar
p*e
5
most time you don't need, default output directory is good enough, but you
can easily change this property.
And if you use option 2), each time you change the output directory, you
must remember change the project 2 class path too.

【在 k***r 的大作中提到】
: hmmm. i have never had to modify output directory in eclipse ...
: Am I missing anything?

相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。