Reputation: 127
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
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
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 artifactapi
- 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