[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.newcomer] Re: Using a class from Java project B in project A

Rodrigo de Salvo Braz wrote:
Hi,

I have a workspace with two Java projects, A and B, in it and want to use, in project A, a class defined in project B.

I have added project B to the "Projects" list of project A's build path. However, when I try to import that class in project A, it is not recognized.

How can I do this?

Hmm, adding Project B to Project A's build path is the correct way to do it. The only other thing I can think to check is that the class in Project B is actually public.


I guess I should ask some more obvious questions, like:
Is it a class that you actually have source for, as opposed to in a JAR in Project B?
Does the class compile correctly in Project B and can it be used from other classes in Project B?


Hope this helps,
Eric