Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

calling a class in another project Eclipse

Tags:

java

eclipse

I have a project "A" and I need to call a class "c" from another project "B".

I have done the following. Click in "A" -->Properties -->Build Path --> and in one tab of Java Source I selected the project B. --> Accept

Now I can create objets of Class "c" but when I run the project I get "ClassNotFoundException"

Update,

I keep getting java.lang.ClassNotFoundException.

In "JSF" -->Properties -->Build Path --> Projects ---> I Added the Project:

enter image description here

In Run --> Run Configurations --> ClassPath I had:

enter image description here

and now I have added the project "JIRA" and "JIRA dependencies" enter image description here

JIRA project has this dependencies:

enter image description here

And I get the following error:

enter image description here

but this class is in M2_REPO:

enter image description here

SOLUTION

I add "JIRA dependencies" only in JARs without Maven: enter image description here and now it´s run.

like image 325
Pablo Gomez Sanmartin Avatar asked Aug 03 '12 09:08

Pablo Gomez Sanmartin


1 Answers

You should add another project in "Project" tab, or add class folder of the project in "Libraries" tab.

example

like image 141
Rangi Lin Avatar answered Oct 19 '22 03:10

Rangi Lin