Tharanga
Tharanga

Reputation: 127

RMI Client and Server programms

I implemented a client and server programms using RMI. I wrote this both server and client classes in same project. But now I want to run this client and server programms separately (as two projects). So how can I do this?

Upvotes: 0

Views: 616

Answers (2)

Eadel
Eadel

Reputation: 3997

You should have main method in each class you want to run. After creating main methods and compiling files, simply run each file, using your IDE or command "java". You don't need two projects to do this.

Upvotes: -1

Tomasz Nurkiewicz
Tomasz Nurkiewicz

Reputation: 340933

Split your application into three artifacts/projects/JARs:

  • client - code that calls the server via RMI API. Depends on api
  • server - implement the API on the server side. Obviously client is not dependent on this artifact
  • api - both client and server depend on API: client uses, server implements.

This approach allows you to develop both client and server independently. Also changing the api can't easily be missed since it is a separate project.

Upvotes: 5

Related Questions