|
Java™ by example!
|
|
|
How do I get started with RMI?
Here's a simple example that uses localhost for both client and server. It was tested on Win2000 machine running JDK1.3.1. The purpose is to create an rmi server that contains a remote method listFiles which the client can call with a path to retrieve the list of files in that directory. - Create a directory c:\rmi. - Create a directory c:\rmi\fileservice. - Create the following files: c:\rmi\fileservice\IFileService.java:
c:\rmi\fileservice\FileService.java:
c:\rmi\fileservice\FileServiceClient.java:
c:\rmi\fileservice\policy.txt:
- Compile all classes:
- Generate the stubs with rmic:
- Run rmiregistry:
- Start the server:
- Start the client:
For more information on the internals of RMI, check the Trail: RMI in Sun's Java Tutorial.
Further Information
Author of answer: Joris Van den Bogaert
Comments
Comments to this answer are only viewable by members. Login or become a member!
|
|
|
|
|