Mikkel
Mikkel

Reputation: 1811

Java RMI implement an interface from other projekt

I'm trying to implement an interface that needs to be implemented by the server but also the client. I am making an RMI server/client system where the client should call the server, and get a value from the server.

It should be a "Remote Interface" between the server and client but i have problems implement it in my server and client programs.

Have made 3 projects in Eclipse

Projekt 1 (Server)

Projekt 2 (Client)

Projekt 3 (Remote Interface)

I want a class inside the Server project named DataImpl to implement the Remote Interface. Have tried to add a JARS in my Server libraries but it dosnen't work.. have these options:

enter image description here

So if i add them, and go to the DataImpl class inside the server, i still wont implement DataI. Here is the options, but they are all wrong.

enter image description here

Hope someone know what the problem is, and what i am doing wrong :)

Upvotes: 0

Views: 671

Answers (2)

Mikkel
Mikkel

Reputation: 1811

I found the answer myself..

You should add the project

In the build path --> Project --> Add --> Choose it!

Upvotes: 1

Crackers91
Crackers91

Reputation: 147

Is the project with the interface on the classpath for the project you want to use it in? If it is, implementing it the way you are doing it is correct. This scenario is just like any other jar file in the class path. One project is including the other project in its classpath and then uses it.

Upvotes: 0

Related Questions