Reputation: 98
There are 2 projects: src and dest with the following structure:
src
com.pkg1
Class1;
dest
com.pkg1
Class2;
In Class2.java
, I have a line import com.pkg1.Class1;
I've added src project in buildpath -> projects of dest project. but I still get the error The import com.pkg1.Class1 cannot be resolved
Upvotes: 1
Views: 64
Reputation: 140427
Within the build path settings for your project src; turn to "Order and export". There you can select which "artifacts" of that project should be "exported".
Meaning: if project src contains Class1, then you instruct project src to export its content ... and then, within project dest build path settings (under Projects) simply select project src.
Probably you need a build all or clean+build all in order to get things working, but as soon as your "exports" and "projects to import" match up ... everything should be fine.
In other words: you do not instruct project dest to use sources from within project src. Instead, you say "project dest depends on project src"; and you define for project src, which stuff is visible to projects depending on it.
Upvotes: 1