• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

access java classes defined in another project in Eclipse

 
ben oliver
Ranch Hand
Posts: 375
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I created a j2ee enterprise project which includes few EJB projects and one Web project. I also created a standalone java project.

In order for my ejb project java code to use the java class defined in that standalone project, I tried the following ways --

a) For the EJB project, I added that standalone project in its "project reference"
b) For the EJB project, in its Java Build path, I added that stand alone project in the "project" tab.

It seems only method b) works and method a) does not.

Wondering why ? I thought if a project A has project B in A's project reference, then any java code in Project B should be visible to java code defined in project A, correct ?
 
Tim Holloway
Saloon Keeper
Pie
Posts: 18100
51
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You don't reference a project in a build, you reference resources.

For example, you might want Project B to be able to use Project A's build classes, but not its test classes. Referring to Project A as a unit wouldn't allow you to make that distinction.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic