Developing
a Java/RMI Server using JRMP
Gopalan Suresh Raj
| Note |
| To
work with any of these samples, you will need the
following: .........................................JDK 1.2 (Java 2) or higher |
The Steps involved in developing and deploying a Java/RMI Server using JRMP (Java Remote Method Protocol) are
1. Develop your Remote Interface
2. Implement your Java/RMI Server
3. Implement an application that creates your server
4. Develop your policy file
5. Compile the files, generate stubs & skeletons, run the RMIRegistry and startup your server
1. Develop your Remote Interface
| SimpleStocks\StockMarket.java |
| package SimpleStocks; import java.util.*; import java.rmi.*; public interface
StockMarket extends java.rmi.Remote { |
2. Implement your Java/RMI Server
| SimpleStocks\StockMarketImpl.java |
| /** * StockMarket */ package SimpleStocks;
public
class StockMarketImpl
public StockMarketImpl( String name ) throws
RemoteException {
public float get_price( String symbol )
{ } |
3. Implement an Application that creates your Server
| StockMarketServer.java |
| /** * Copyright: Copyright (c) 1998 * Author: Gopalan Suresh Raj */ import java.rmi.*; public class StockMarketServer {
public static void main(String[] args) throws Exception {
|
4. Develop your security policy file
| policy.all |
| grant { permission java.security.AllPermission "", ""; }; |
5. Compile the Files, generate the stubs & skeletons, startup the RMIRegistry and Run the Server
E:\MyProjects\StockRMI\SimpleStocks> E:\MyProjects\StockRMI\SimpleStocks>javac *.java E:\MyProjects\StockRMI\SimpleStocks>cd.. E:\MyProjects\StockRMI>rmic SimpleStocks.StockMarketImpl E:\MyProjects\StockRMI>javac *.java E:\MyProjects\StockRMI>start rmiregistry E:\MyProjects\StockRMI>java -Djava.security.policy=policy.all StockMarketServer RMI StockMarketServer ready... |
click here to go
to
My
Advanced Java/J2EE Tutorial Page...
This site was developed and is maintained by Gopalan Suresh Raj |
||
Last Updated : Dec 19, '98 |
||
Copyright (c) 1997-99, Gopalan Suresh Raj - All rights reserved. Terms of use. |
All products and companies mentioned at this site,are trademarks of their respective owners. |